Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

thread::pool scalars leaked and segmentation fault

by gsiglet (Acolyte)
on Apr 19, 2013 at 12:55 UTC ( [id://1029507]=perlquestion: print w/replies, xml ) Need Help??

gsiglet has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I have been using the Thread::Pool module in one of my scripts to process plenty of files, as follows:
my $threadpool = Thread::Pool->new({ 'do' => \&my_function, 'optimize' => 'cpu', , 'workers' => 20, }); $threadpool->job($_) for (@myfiles); $threadpool->shutdown(); sub my_function { my ($file) = @_; ... return 1; }
From time to time I am receiving the following:
Scalars leaked: 1 Scalars leaked: 1 Scalars leaked: -1 Scalars leaked: 1
and sometimes I am receiving a segmentation fault error: (/bin/sh: line 1: 10999 Segmentation fault /bin/my_script.pl) I am not sure what's going on and how to debug this. Does anybody have any idea? Many thanks, George

Replies are listed 'Best First'.
Re: thread::pool scalars leaked and segmentation fault
by choroba (Cardinal) on Apr 19, 2013 at 13:00 UTC
    Do not use Thread::Pool. It is buggy. Switch to Thread::Queue.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: thread::pool scalars leaked and segmentation fault
by djerius (Beadle) on Apr 19, 2013 at 20:34 UTC
Re: thread::pool scalars leaked and segmentation fault
by gsiglet (Acolyte) on Apr 24, 2013 at 10:10 UTC
    I switched to Thread::Queue. The problem persists. It should be something else. Maybe something in my code is not thread safe. This is difficult to debug
Re: thread::pool scalars leaked and segmentation fault
by gsiglet (Acolyte) on Apr 26, 2013 at 10:36 UTC
    Seems to be something wrong with Log4Perl within "my_function". If I remove the log4perl call that I have there it seems not to break anymore. I will continue testing

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1029507]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-20 02:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found