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
Segmentation fault in Perl_csighandler when receiving SIGCHLD & using threads #13515
Comments
From thierry.vignaud@gmail.comI'have a program which uses threads (but not willingly) and has a custom signal handler for SIGCHLD.. If a SIGCHLD is received & handled by a custom signal handler before the thread creation by the libraries, perl segfaults. Here is the stacktrace from gdb: The segfaults happen since glib was upgraded from glib-2.34 to 2.36 & were seen with both perl-5.16 & 5.18. I've workarounded this in some tools by setting SIG{CHLD} later. I can still make mcc (Mageia Control Center) to reliably segfault by setting SIG{CHLD} earlier (by moving "$SIG{CHLD} =..." at top of /usr/libexec/drakconf) Basically, we segfault in SIG_CHLD when webkit threads exit (webkit creates temporary ones on init). So, as far as I'm concerned there's 2 bugs: There was an old bug that got fixed in perl-5.10.0: This report looks like a variant of this bug (and is happening b/c of glib's & webkit's threads). It can be reproduced with either the attached script or one of the following one-liners: perl -MGtk2 -MGtk2::WebKit -e '$SIG{CHLD} = sub { warn }; Gtk2->init; my $wiew = Gtk2::WebKit::WebView->new; $w=Gtk2::Window->new; $w->add($view); Gtk2->main' perl -MGtk3 -MGtk3::WebKit -e '$SIG{CHLD} = sub { warn @_ }; Gtk3->init; my $wiew = Gtk3::WebKit::WebView->new; $w=Gtk3::Window->new; $w->add($view); Gtk3->main' |
The RT System itself - Status changed from 'new' to 'open' |
From thierry.vignaud@gmail.comThis is perl-5.18.1 as provided by Mageia and is indeed patched by vendor: |
From @tonycozOn Tue Jan 07 16:48:15 2014, tonyc wrote:
tony@mars:.../git/perl2$ gdb --args ~/perl/5.18.0-thr-debug/bin/perl -MGtk2 -MGtk2::WebKit -e '$SIG{CHLD} = sub { warn }; Gtk2->init; my $view = Gtk2::WebKit::WebView->new; $w=Gtk2::Window->new; $w->add($view); Gtk2->main' Program received signal SIGSEGV, Segmentation fault. which I suspect means we need to initialize THX here in a similar way we do on Win32: void * Tony |
From thierry.vignaud@gmail.comCare to suggest a patch that I can test? |
From @LeontOn Tue Jan 07 16:06:32 2014, thierry.vignaud@gmail.com wrote:
This sounds like csighandler is running in a thread that doesn't have any associated perl interpreter. One solution might be to block SIGCHLD (and possibly other signals) during thread creation (see also Signal::Mask or POSIX::sigprocmask), that way the signal will never be delivered to them (unless they accidentally unblock it). Leon |
From thierry.vignaud@gmail.comOn Tue Jan 07 18:12:41 2014, LeonT wrote:
As stated in my initial report, I do not have control over the threads So I would have to identify every places in the libraries that can result |
From @shlomifI am able to reproduce this problem with a perl built like so: #!/bin/sh from the Git maint5.18 branch, on Mageia Linux x86-64 4 Cauldron, and after installing the Gtk2 and Gtk2::WebKit modules from CPAN. When I run the program as my normal user everything runs fine. When I run it as root, it crashes. When I run it under gdb as root, the program does not crash. Let me know if I can be of further assistance. Regards, -- Shlomi Fish |
From @tonycozOn Tue Jan 07 18:12:41 2014, LeonT wrote:
I'll look at fixing this as part of my 81074 work. Tony |
From thierry.vignaud@gmail.comOn 8 January 2014 01:48, Tony Cook via RT <perlbug-followup@perl.org> wrote:
This is perl-5.18.1 as provided by Mageia and is indeed patched by vendor: |
Looks that this doesn't happen anymore as of perl-5.30.1 |
Closing as the bug is reported to be fixed. |
Migrated from rt.perl.org#120951 (status was 'open')
Searchable as RT120951$
The text was updated successfully, but these errors were encountered: