in reply to Re: Event module and threads/fork segfault on Win32
in thread Event module and threads/fork segfault on Win32
#!/usr/bin/perl use strict; use warnings; use threads; sub create_thread { warn "in create_thread() before async()\n"; my $thr = async { warn "in thread\n"; }; warn "in create_thread() before join()\n"; sleep 2; $thr->join; warn "in create_thread() before return\n"; return; } use Event; my $timer = Event->timer( cb => \&create_thread, after => 2); warn "starting event loop\n"; Event::loop;
Perl exited with active threads: 0 running and unjoined 1 finished and unjoined 0 running and detached
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Event module and threads/fork segfault on Win32
by BrowserUk (Patriarch) on Jun 05, 2007 at 03:37 UTC | |
The next question is which versions of Perl, threads and Event are you using? I just ran your script under AS811/5.8.6 with threads v1.05 and Event v1.09 and it completed without a segfault, and just a warning for a leaked scalar?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
by gurbo (Sexton) on Jun 05, 2007 at 13:49 UTC | |
The OS is WinXP Professional SP2 running in a VMWare VM v5.5.51 build-19175 The real code starts threads in one watcher and joins them in another to collect their exit statuses. In that situation it gets the "leaked scalar" before the segfault. | [reply] [d/l] |
by BrowserUk (Patriarch) on Jun 05, 2007 at 16:04 UTC | |
To resolve this you're probably going to have to track down which version of what caused things to break and then raise a specific bug report against the specific component. And that will likely be a PITA, as there are so many versions and combinations of versions to test. For example; threads appears to have gone through around 20+ version between where you are and I am. A few things that might help: HTH some. Good luck. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
by BrowserUk (Patriarch) on Jun 06, 2007 at 03:12 UTC | |
It would appear to be 5.8.8 that is the deciding factor as to whether it segfaults or not. Having installed the latest versions threads:v1.62 and Event:v1.09; I get no trap from your code under 5.8.6(AS811), but I do under 5.8.8(AS817). However, if I do not nest the threads stuff inside the Event callback, no trap occurs either. HTH. Update: I finally got the segfault to occur under the auspices of a debugger. The trap is occurring in ev.c:187, when the if statement attempts to access WvACTIVE(wa). That doesn't explain why it happens, but it might give somebody a starting point.
And a stack trace:
I'm intrigued by what you are trying to achieve by mixing these two anyway? Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |