Multithreading woes on Linux

Juan Jose Comellas jcomellas at gmail.com
Sun Apr 23 09:46:32 PDT 2006


It seems that there is a problem in the code generated by DMD or the code in
Phobos when using multithreading on Linux. I've been trying several ways of
rewriting my programs to avoid this problem, but I've had no success so
far. The crashes always happen inside the garbage collector. The line
reported by gdb is:

#0  0x0806a978 in _D3gcx3Gcx4markFPvPvZv () at gcx.d:1318
1318                byte *p = cast(byte *)(*p1);

It looks like the pointer that's being dereferenced by the GC is invalid.
I've added checks before this line to see if it was a NULL pointer and it's
not. Surprisingly (or not), my program crashes almost immediately if Phobos
and the GC are compiled with optimizations. If I only leave "-g" as the
DFLAGS in the makefiles I get these crashes much less frequently.  

In the test program I'm using I have two threads. The crash is happening on
thread 1. The full backtrace I get for the crash is attached to this post.

I'm trying to write a simplified sample program and I'll post it once I have
it ready. Walter, if you have a minute, I'd appreciate you looking into
this.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: threaded_crash_linux.txt
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20060423/3472b6c1/attachment.txt>


More information about the Digitalmars-d mailing list