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