Hi,

I've been tracking down a bug that is causing a nasty crash in my XS module. The module spawns several C threads, each with their own Perl interpreter. The idea is that fragments of Perl code can be sent to each thread to be run. The fragment of Perl code can also call functions, which are themselves XS (i.e., there is a way for the running code to "communicate" back to the calling thread via messages).

For the most part things are ok:) However, under windows I now and again get random crashes. The module is cross platform, with 5.6 being the main target. When run under Linux there is no problem, and even Valgrind doesn't say anything.

The stack trace always shows Perl_my_atof to be the culprit:

Call stack:
28073FD4  Perl56.dll:28073FD4  Perl_my_atof
28074FCA  Perl56.dll:28074FCA  Perl_my_atof
2803898B  Perl56.dll:2803898B  Perl_sv_compile_2op
28051EC8  Perl56.dll:28051EC8  Perl_runops_standard

Could it be that this function isn't thread safe? (I'm using an Activestate build of Perl).

The other thing I suspect is that I'm somehow messing up the Perl stack - again, the call stack almost always fails at call_sv (often this call_sv has been called indirectly by another call_sv). Could this be a possibility - and would it cause the kind of crash that I'm seeing?

I've been trying to track this bug down for days now - I'm even dreaming about it - I'm almost at the point of throwing the computer out of the window!

Any pointers, or suggestions on how to debug this would be greatly appreciated.

Cheers,

jez.


Reply via email to