in reply to Re^9: Threads calling LWP causes exception
in thread Threads calling LWP causes exception
You may be happy to know that I finally reproduced your problem here using the above code, and I've reduce the failure case to this:
package main; use strict; use warnings; use v5.8; use POSIX qw[ _exit ]; use threads; sub GetIt2 { require LWP::Simple; return LWP::Simple::get( $_[0] ); } #print GetIt2( $ARGV[ 0 ] ); #print threads->create( \&GetIt2, $ARGV[ 0 ] )->join; #_exit(0);
This seems to be a bad interaction during cleanup between libeay32.dll and thread.pm.
The keys to the failure seem to be:
It will require somebody with greater internals skills to resolve that further, so you should raise a perlbug. The code above should suffice as a testcase.
I've two workarounds for you.
The failure does not seem to occur unless you do that.
The error does not seem to occur then either.
This is not a good solution as it effectively bypasses Perl's cleanup, which means open files don't get closed properly, destructors don't get called etc. If your code relies on any of the cleanup events for proper function, it could give you problems.
That said, if you ensure that all your files are closed and data is saved before you call POSIX::_exit(), it will avoid the exception, so it worth considering as a last resort until a proper solution is found and implemented.
Disclaimer: It's at your own risk and I didn't tell you about it :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: Threads calling LWP causes exception
by mojoshaneman (Novice) on Mar 11, 2006 at 17:33 UTC |