Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: LWP, DBI and Free to Wrong Pool error

by mnooning (Sexton)
on Apr 29, 2007 at 00:03 UTC ( #612597=note: print w/ replies, xml ) Need Help??


in reply to Re^3: LWP, DBI and Free to Wrong Pool error
in thread LWP, DBI and Free to Wrong Pool error

I was getting Free to wrong pool last year when I attempted to use the
Windows Fork with Tk being used in the child process. The details of
my problem set were different than yours but perhaps the overall
problem set and solution approach could be similar.

After some digging, the problem turned out that Tk was not thread
safe. My answer was to use the fork earlier on in the program, and not
"use Tk" in any module prior to the module that used the fork.

The parent does some things and waits a prescribed time for the child
to finish just as before, only instead of the child pop up any error
message, which is what used Tk, the child now writes any reports to a
temp file (that is known to the parent). After the child exits - or
is killed by the parent - the parent then returns the file contents
to the caller, and a subsequent module handles using Tk to pop up any
error messages.

One more thing. If you decide to use the Windows fork, do not use the
sleep command in the parent or child. It hangs. Instead, use

select(undef, undef, undef,whatever);


Comment on Re^4: LWP, DBI and Free to Wrong Pool error
Re^5: LWP, DBI and Free to Wrong Pool error
by BrowserUk (Pope) on Apr 29, 2007 at 00:20 UTC
    ne more thing. If you decide to use the Windows fork, do not use the sleep command in the parent or child. It hangs.

    You sure? I've never encountered that:

    C:\test>perl -le"if(fork){sleep 5;print'parent'}else{sleep 7;print'chi +ld'}" parent child

    Got code to demonstrate it?

    Also, Win32::Sleep( $milliseconds ); is better that 4-arg select, and is built-in (doesn't need a module).


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2014-07-23 06:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (133 votes), past polls