in reply to Problem with threads + join

(for sumanth: you find nothing new here. For the rest: I want to summarize a discussion we had on the CB, hopefully other monks can profit from it).

This is a XY Problem. The reason not to simply call $thread->join was that this command reveals error messages like attempted to free unreferenced scalar...

I tested the code that produced the errors, and confirmed them on perl 5.8.8. On 5.10.0 they were fixed.

Now sumanth can't upgrade to 5.10.0, and tries to find a workaround.

While a workaround is perfectly fine (IMHO) when a feature is missing, I think in this case here it is folly, because

  1. generally working around a buggy environment is unproductive, and usually doesn't work in the end
  2. the ->join call probably only reveals the error, it's likely not the cause. That means that the workaround is in the wrong place (if there is a right place at all)
  3. There seems to be an error somewhere that in perl's reference counting. If there is, and it is triggered by a program, it can result in bugs that are very hard to reproduce and hard to find, and perhaps even data corruption or loss.

So I think to preserve your sanity, dear sumanth, you should find a different solution. Perhaps without threads (maybe forks or non-blocking IO might help?), perhaps with a second perl installation, perhaps with a different programming language.