Generally the 'attempt to free unrerefenced scalar' error is an
indication of a bug in perl (or XS code). Threads in early versions of 5.8.x are well-known for these sorts of problems.
Try upgrading to something newer (preferably 5.8.6) and see if the problem goes away.
Dave.
Comment on Re: Problems with a thread-pooled tcp server
Yes, that was the problem, thanks. I installed a copy of 5.8.6 locally in my home directory and ran it against that and the problem went away. For some reason I was just stuck on the idea that it must be my code, never thought about questioning perl itself :)