Skip Menu |
 

This queue is for tickets about the PAR-Packer CPAN distribution.

Report information
The Basics
Id: 68892
Status: open
Priority: 0/
Queue: PAR-Packer

People
Owner: Nobody in particular
Requestors: PECO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: perl-threads @ Linux => Segment fault
Download (untitled) / with headers
text/plain 523b
Hello. First, thanks for your time. I'm using PAR::Packer to build a single executable of my App, in order to be distributed in an easier way. My App uses Threads and I noted that the executable, it crashes (segment fault) when it creates the first thread. It's wierd due that this behaviour is only in Linux (in Windows, it runs perfectly). I'm building the executable with: pp myapp.pl -o myapp I found this: http://www.mail-archive.com/par@perl.org/msg03195.html Again, thank you very much for your time. Peco
Download (untitled) / with headers
text/plain 288b
On 2011-06-17 06:14:16, PECO wrote: Show quoted text
The example given in above post works fine here (Perl 5.8.8 built for x86_64-linux-thread-multi, PAR::Packer 1.009). Can you provide a minimal exampls that fails? Cheers, Roderich
CC: par [...] perl.org
Subject: Re: [rt.cpan.org #68892] perl-threads @ Linux => Segment fault
Date: Mon, 20 Jun 2011 12:33:30 +0200
To: bug-PAR [...] rt.cpan.org
From: Juan José 'Peco' San Martín <jsanmartin [...] gmail.com>
Download (untitled) / with headers
text/plain 1.2k
Hi I've been studying the issue, and here is my workaround. The program uses Threads, Threads::Shared, Tk and opens several sockets. It works fine as .pl although it uses the directive: threads->set_stack_size(30000); in order to avoid a Segment Fault. If I PAR'ed' this program (pp program.pl -o program) is needed to make the stack bigger. For example from 3000 to 35000 (just a try, I didn't analyze the exact value).. It's weird due that at Microsoft platform, I don't need to set the stack size (as .pl or as PAR). Anybody has any idea of why? Thanks Peco * * 2011/6/20 Roderich Schupp via RT <bug-PAR@rt.cpan.org> Show quoted text
> Mon Jun 20 04:02:16 2011: Request 68892 was acted upon. > Transaction: Correspondence added by RSCHUPP > Queue: PAR > Subject: perl-threads @ Linux => Segment fault > Broken in: (no value) > Severity: Important > Owner: Nobody > Requestors: PECO@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=68892 > > > > On 2011-06-17 06:14:16, PECO wrote: > > The example given in above post works fine here (Perl 5.8.8 built for > x86_64-linux-thread-multi, PAR::Packer 1.009). Can you provide > a minimal exampls that fails? > > Cheers, Roderich >
Download (untitled) / with headers
text/plain 528b
On 2011-06-20 06:33:40, jsanmartin@gmail.com wrote: Show quoted text
> The program uses Threads, Threads::Shared, Tk and opens several
sockets. It Show quoted text
> works fine as .pl although it uses the directive: > threads->set_stack_size(30000); in order to avoid a Segment Fault.
You still haven't provided an example that I can test against. Also, if the segfault is due to an insufficient stack size (as your workaround suggests) then this can't be construed as a bug in PAR::Packer. And PAR::Packer can't do anything about it anyway. Cheers, Roderich
CC: par [...] perl.org
Subject: Re: [rt.cpan.org #68892] perl-threads @ Linux => Segment fault
Date: Mon, 20 Jun 2011 13:29:31 +0200
To: bug-PAR-Packer [...] rt.cpan.org
From: Juan José 'Peco' San Martín <jsanmartin [...] gmail.com>
Download (untitled) / with headers
text/plain 1.1k
You are right, I need time to show you an example (sorry the App is huge and it's not easy to strip it). Anyway, the issue is that the stack should be increased if you want to PAR it, and I don't understand why. Thanks Peco 2011/6/20 Roderich Schupp via RT <bug-PAR-Packer@rt.cpan.org> Show quoted text
> Mon Jun 20 07:05:17 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 06:33:40, jsanmartin@gmail.com wrote:
> > The program uses Threads, Threads::Shared, Tk and opens several
> sockets. It
> > works fine as .pl although it uses the directive: > > threads->set_stack_size(30000); in order to avoid a Segment Fault.
> > You still haven't provided an example that I can test against. > > Also, if the segfault is due to an insufficient stack size > (as your workaround suggests) then this can't be construed > as a bug in PAR::Packer. And PAR::Packer can't do anything > about it anyway. > > Cheers, Roderich >
Download (untitled) / with headers
text/plain 480b
On 2011-06-20 07:29:40, jsanmartin@gmail.com wrote: Show quoted text
> 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
CC: par [...] perl.org
Subject: Re: [rt.cpan.org #68892] perl-threads @ Linux => Segment fault
Date: Mon, 20 Jun 2011 17:50:25 +0200
To: bug-PAR-Packer [...] rt.cpan.org
From: Juan José 'Peco' San Martín <jsanmartin [...] gmail.com>
Download (untitled) / with headers
text/plain 2.2k
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 >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.