[Mono-bugs] [Bug 377738] New: Interleaved stack traces in multi-threaded program

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 7 16:52:37 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=377738


           Summary: Interleaved stack traces in multi-threaded program
           Product: Mono: Runtime
           Version: 1.2.6
          Platform: PC
        OS/Version: RHEL 5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: mes at zeroc.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


When I press Ctrl+\ (SIGQUIT) to generate the stack traces of a
running program, the output is very difficult to decipher because
the stack traces are printed concurrently by each thread. A simple
test case is attached.

Expected output:

Waiting...
Full thread dump:

"" tid=0x0x1124d0 this=0x0x21e10:
  at (wrapper managed-to-native) System.Threading.Thread.Join_internal
(int,intptr) <0x00004>
  at (wrapper managed-to-native) System.Threading.Thread.Join_internal
(int,intptr) <0xffffffff>
  at System.Threading.Thread.Join () <0x00012>
  at ThreadTest.Main (string[]) <0x00143>
  at (wrapper runtime-invoke) ThreadTest.runtime_invoke_void_string[]
(object,intptr,intptr,intptr) <0xffffffff>

"Thread1" tid=0x0xab1b90 this=0x0x21c30:
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0x00004>
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0xffffffff>
  at System.Threading.Thread.Sleep (int) <0x00016>
  at ThreadTest.runThread1 () <0x0000c>
  at (wrapper delegate-invoke) System.MulticastDelegate.invoke_void ()
<0xffffffff>
  at (wrapper runtime-invoke) System.Threading.ThreadStart.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>

"Thread2" tid=0x0xc0fb90 this=0x0x21b40:
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0x00004>
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0xffffffff>
  at System.Threading.Thread.Sleep (int) <0x00016>
  at ThreadTest.runThread2 () <0x0000c>
  at (wrapper delegate-invoke) System.MulticastDelegate.invoke_void ()
<0xffffffff>
  at (wrapper runtime-invoke) System.Threading.ThreadStart.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>

"Thread3" tid=0x0xdcfb90 this=0x0x21a50:
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0x00004>
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0xffffffff>
  at System.Threading.Thread.Sleep (int) <0x00016>
  at ThreadTest.runThread3 () <0x0000c>
  at (wrapper delegate-invoke) System.MulticastDelegate.invoke_void ()
<0xffffffff>
  at (wrapper runtime-invoke) System.Threading.ThreadStart.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>
Done.

Actual output:

Waiting...
Full thread dump:

"" tid=0x0x14f6e0 this=0x0x21e10:

"Thread1" tid=0x0x2ecbb90 this=0x0x21c30:
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0x00004>
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0xffffffff>
  at System.Threading.Thread.Sleep (int) <0x00016>
  at ThreadTest.runThread1 () <0x0000c>

"Thread3"  at (wrapper delegate-invoke) System.MulticastDelegate.invoke_void ()
<0xffffffff>
 tid=0x0x145bb90 this=0x0x21a50:
  at (wrapper runtime-invoke) System.Threading.ThreadStart.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0x00004>
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0xffffffff>
  at System.Threading.Thread.Sleep (int) <0x00016>
  at ThreadTest.runThread3 () <0x0000c>
  at (wrapper delegate-invoke) System.MulticastDelegate.invoke_void ()
<0xffffffff>
  at (wrapper runtime-invoke) System.Threading.ThreadStart.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>

"Thread2" tid=0x0x1c0eb90 this=0x0x21b40:
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0x00004>
  at (wrapper managed-to-native) System.Threading.Thread.Sleep_internal (int)
<0xffffffff>
  at System.Threading.Thread.Sleep (int) <0x00016>
  at ThreadTest.runThread2 () <0x0000c>
  at (wrapper delegate-invoke) System.MulticastDelegate.invoke_void ()
<0xffffffff>
  at (wrapper runtime-invoke) System.Threading.ThreadStart.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>
  at (wrapper managed-to-native) System.Threading.Thread.Join_internal
(int,intptr) <0x00004>
  at (wrapper managed-to-native) System.Threading.Thread.Join_internal
(int,intptr) <0xffffffff>
  at System.Threading.Thread.Join () <0x00012>
  at ThreadTest.Main (string[]) <0x00143>
  at (wrapper runtime-invoke) ThreadTest.runtime_invoke_void_string[]
(object,intptr,intptr,intptr) <0xffffffff>
Done.

Workaround:

The Mono folks may have a better solution, but I fixed it locally
by accumulating the stack trace of each thread into a string and
then printing the result in one call to fprintf (see attached
patch). Note that this patch only fixes the output for SIGQUIT;
a similar fix may be necessary for handling other signals.

I didn't test with Mono 1.9, but I compared Mono 1.2.6 to 1.9 and
didn't see any changes that would be relevant for this issue.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list