Ok, first say that IMHO is not a bug about PAR. In case somebody can
reproduce the behavior, maybe we could add a note somewhere for developers.
I did some tests and...if a thread that calls another thread (to force the
usage of the stack) loads a good amount of perl modules, then, in case we
want to PAR it, we should increase the stack by hand.
I did the tests with perl, v5.10.1 / Ubuntu 10.10 / Intel(R) Atom(TM) 2G Ram
If I create the PAR (pp sample.pl -o sample) of the next piece of perl, I
get SegFault.
--------------------- cut
#!/usr/bin/perl
use strict;
use warnings;
use threads();
use threads::shared;
### Load modules (Tk is useful here but you can choose your own stuff)
use Tk;
use Tk::ProgressBar;
use Tk::NoteBook;
use LWP::UserAgent;
use Net::Ping;
use IO::Socket::INET;
use Net::SNMP;
threads->set_stack_size(30000); # you should increase this value by 5000 to
safely PAR it
sub foo
{
# just launch a thread...";
my $thread=threads->create(\&_nothing);
$thread->detach();
return;
}
sub _nothing {
return;
}
my $thr=threads->create(\&foo);
while(1){}; # eternal loop or SegFault depending on the stack_size value.
threads->detach;
threads->exit;
------------------------ cut
Ok, is not the best example, but I think it should be useful to show.
Why it works on Microsoft?
Because on Windows the default stack_size (see Threads) is much bigger.
Thanks,
Peco
2011/6/20 Roderich Schupp via RT <bug-PAR-Packer@rt.cpan.org>
Show quoted text> Mon Jun 20 09:54:59 2011: Request 68892 was acted upon.
> Transaction: Correspondence added by RSCHUPP
> Queue: PAR-Packer
> Subject: perl-threads @ Linux => Segment fault
> Broken in: (no value)
> Severity: Important
> Owner: Nobody
> Requestors: PECO@cpan.org
> Status: open
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=68892 >
>
>
> On 2011-06-20 07:29:40, jsanmartin@gmail.com wrote:
> > Anyway, the issue is that the stack should be increased if you want to
> PAR
> > it, and I don't understand why.
>
> Dunno. Just a wild guess: maybe the program has already a larger stack
> allocated before your "use threads".
> There has a lot been going on perlwise in a packed executable
> before execution reaches even the first line of your script.
> Also note that the whole script execution is inside a BEGIN block.
>
> Cheers, Roderich
>