-
Notifications
You must be signed in to change notification settings - Fork 581
Perl SEGV #23326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Possibly fixed by 85e9706 |
So you're suggesting that the Oracle instant client lib starts one or more additional non Perl threads that may leak into Perl land causing mayhem? That wouldn't seem like the typical M.O. of a dynamic library. |
It's only a problem when you mix library worker threads with signals. Your backtrace:
shows this isn't a perl thread. |
Thanks for the observation. I thought the GDB output seemed to suggest this wasn't a main thread; but I wasn't exactly ready to believe because I'm not creating any additional Perl threads. I have confirmed that once the Perl has connected and then disconnected from the DB the process does have an additional thread. I can easily see it by inspecting /proc/$$/status. Once created my app is extremely suspectable to SEGV's. I'm in no position to coerce or convince the Perl maintainers to make change to Perl's SIG handling. ALSO: I have yet to find a way to tell the OCI to I suppose there is a reason Oracle didn't have a built-in solution to funnel signals to the main thread; starting with they know a whole lot more than I do on the subject. |
So does this still happen on blead or not? It's not clear which Perl version you're using. |
I read somewhere online (gossip), pthreads wants to or did actually deploy to prod a change, that their Upgrading to 16 byte structs did cause widespread generic common POSIX app breakage, because suddenly Google brings up https://forums.oracle.com/ords/apexds/post/issue-with-system-call-with-libclntsh-so-19-1-0673 and SIGCHILD drama. |
SP my API names before using them. 1 WinPerl has an
|
@tonycoz, is this a perl problem or a DBD-Oracle problem? If the latter, then we should direct the OP to a more appropriate place to file this bug report. Thanks. |
This is a Perl vs libraries that create non Perl worker threads. PERL can't cope with non Perl threads entering its domain. |
It appears to be the same as #22487 which is fixed in blead. We won't know if it fixes it for OP until they test it, though they might run into other DBD::Oracle issues along the way. Edit: if you're using a vendor perl you might be able to convince them to backport 85e9706 |
pthreads isn't a specific implementation, but a specification. That specification does allow for non-scalar Though I kind of doubt any implementation does use non-scalar
The thread start function for the thread is in |
https://www.ibm.com/docs/en/open-xl-c-cpp-zos/2.1.0?topic=guide-binary-compatibility Internal type went from https://github.com/nginx/unit/blob/master/src/nxt_thread_id.h#L171 good reference. It seems from my opinion, to say, certain pthread impls, pack a ptr and a 0 based kernel tid or a certain readable or unreadable memory address that the kernel returns as a "thread obj ref", together in 1 void * or into 8 bytes. The bitfield space is gained by extreme alignment of the master pthread struct, at 4096, or 10s of KBs to free up space in the void * for the kernel TID. The platform/CPU/OS might be lacking a dedicated TLS register, and having to ask the kernel each time for an abstract TID, and somehow convert the abstract number back into their large pthread internal C struct. |
I have tested the patch placed in "bleed" (mentioned above) that forces Perl "WOOL' on to the non-Perl thread and then allows it to continue to handle the interrupt. I've also tested an alternative (though a real Perl internals developer should make it conform to Perl standards); Both work well to eliminate the SEGV when a non-Perl worker thread is called upon to enter Perl land to handle an interrupt. For the time being I'll apply said patch to any Perl I build within my organization as I can't use bleed there. The alternative is shown here: perl5-dbi/DBD-Oracle#192 |
The patch you show as applied to blead in perl5-dbi/DBD-Oracle#192 isn't what was applied to blead. blead (5.42 to be) currently uses pthread_kill() to forward the signal to the main thread. |
The example I used was something I made up (the alternative) simply to convey the intent not the final code. I'll have another look and if there is a bleed fix that passes the interrupt along that's a better solution and why I offered the example SU-DO code. As for the the original approach that someone claimed to put in bleed is on them. I saw the code and the comment they made and I tested it. I don't really know anything about bleed. I just tried to connect the dots so others could follow If they wished. |
Uh oh!
There was an error while loading. Please reload this page.
Module:
Description
Perl SEGV's during SIGCHLD.
BTW I opened #23241 before but that issue has been fixed by a patch and pull request submitted the DBD::Oracle myself. This isn't an Oracle only issue. Apparently and dynamic library that creates threads could find their way into Perl land trying to service an interrupt.
Steps to Reproduce
The steps to reproduce are reported within perl5-dbi/DBD-Oracle#192
I have added a test that reproduces the SEGV t/92-segv-fork.t
Expected behavior
Perl should not SEGV
Perl configuration
The text was updated successfully, but these errors were encountered: