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);

In reply to Re^4: LWP, DBI and Free to Wrong Pool error by mnooning
in thread LWP, DBI and Free to Wrong Pool error by cormanaz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.