[Issue 13426] New: crash when using exceptions in a non-d thread (in thread_stackBottom)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Sep 5 13:28:36 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13426

          Issue ID: 13426
           Summary: crash when using exceptions in a non-d thread (in
                    thread_stackBottom)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: blastrock at free.fr

Created attachment 1418
  --> https://issues.dlang.org/attachment.cgi?id=1418&action=edit
minimal example that crashes

Hi,

When a thread is created from C++ (or probably any other language) and this
thread calls back to a D function which deals with exceptions (even if they are
properly caught), the program will crash.

Here is the stack:
#0  0x000000000041f469 in thread_stackBottom ()
#1  0x000000000041ee5a in core.runtime.defaultTraceHandler() ()
#2  0x000000000041ee01 in core.runtime.defaultTraceHandler() ()
#3  0x000000000041e6a1 in _d_traceContext ()
#4  0x000000000041bf78 in _d_createTrace ()
#5  0x0000000000417872 in _d_throwc ()
#6  0x000000000041746d in test.throwit() () at test.d:15
#7  0x00000000004173fe in callback() () at test.d:6
#8  0x00007ffff7bd956d in std::_Bind_simple<void
(*())()>::_M_invoke<>(std::_Index_tuple<>) (this=0x647708) at
/usr/include/c++/4.9/functional:1700
#9  0x00007ffff7bd94b5 in std::_Bind_simple<void (*())()>::operator()()
(this=0x647708)
    at /usr/include/c++/4.9/functional:1688
#10 0x00007ffff7bd9432 in std::thread::_Impl<std::_Bind_simple<void (*())()>
>::_M_run() (
    this=0x6476f0) at /usr/include/c++/4.9/thread:115
#11 0x00007ffff6eac8a0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#12 0x00007ffff77b30a4 in start_thread (arg=0x7ffff6bdf700) at
pthread_create.c:309
#13 0x00007ffff71e7c2d in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

I attached a minimal example. Just run build_and_gdb.sh which will compile the
c++ library, the d program and start gdb on it.

--


More information about the Digitalmars-d-bugs mailing list