Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Parallel::ForkManager dies with "Free to wrong pool..."

by dave_the_m (Monsignor)
on Jun 14, 2018 at 20:19 UTC ( #1216663=note: print w/replies, xml ) Need Help??


in reply to Parallel::ForkManager dies with "Free to wrong pool..."

how can I call a non-threadsafe module sub from multiple parallel spawned child threads
There are no guarantees of course, but you're likely to have better results if you 'require' the problematic module within each child thread/process, rather than use/requiring it in the parent process - which causes its data to be copied to each child via thread cloning (which is how fork() is implemented on Windows perl).

Dave.

  • Comment on Re: Parallel::ForkManager dies with "Free to wrong pool..."

Replies are listed 'Best First'.
Re^2: Parallel::ForkManager dies with "Free to wrong pool..."
by perlygapes (Novice) on Jun 15, 2018 at 01:50 UTC
    Davidic counsel has borne scriptural truth.

    According to thy wisdom, I crucified

    use Digest::MD5 qw(md5_hex); use Math::Prime::Util ':all'; ... $unique_offering = todigitstring(fromdigits(md5_hex($harvest), 16), 36 +);

    and resurrected
    $unique_offering = sub { require Digest::MD5; require Math::Prime::Util; return Math::Prime::Util->todigitstring( Math::Prime::Util->fromdigits( Digest::MD5->md5_hex($harvest), 16), 36); };

    Lo, and behold, as you spake, so it came to pass...

    My humble thanks to you.

Re^2: Parallel::ForkManager dies with "Free to wrong pool..."
by perlygapes (Novice) on Jun 14, 2018 at 23:20 UTC

    And many thanks to you too, Sir!

    After all my meditations, I began to wonder if it should be required by each child instead.

    I will take your sage advice and apply it in faith.

Re^2: Parallel::ForkManager dies with "Free to wrong pool..."
by perlygapes (Novice) on Jun 18, 2018 at 23:02 UTC
    I bid thee, wouldest thou consider my supplication one more time?

    Oh my children, what shall I do?

    It seems I was presumptuous - it transpires my children have gone from killing each other to becoming pharasees, religiously quoting scriptural CODE(0xHHHHHH) references without following or understanding the purpose of my anonymous subroutine I assigned them

    This:

    $unique_offering = sub { require Digest::MD5; require Math::Prime::Util; return Math::Prime::Util->todigitstring( Math::Prime::Util->fromdigits( Digest::MD5->md5_hex($harvest), 16), 36); };

    now produces this:

    $unique_harvest # "CODE(0xHHHHHH)"

    I desire self expressions of love, not robots...
    I have studied the scriptures of other faiths, but I have not found any answers :-/

    What do ye advise?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1216663]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2019-05-25 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (152 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!