|
From: Konstantin S. <kon...@gm...> - 2009-12-09 21:50:44
|
On Wed, Dec 9, 2009 at 11:42 PM, Greg Parker <gp...@ap...> wrote: > > On Dec 9, 2009, at 9:13 AM, Alexander Potapenko wrote: > > > Hi everyone, > > > > Debugging ThreadSanitizer for Mac OS > > (http://code.google.com/p/data-race-test) I've came up with a small > > piece of code that makes Valgrind-based threading tools act in a weird > > manner. > > > > The attached code exploits NSOperationQueue from the Foundation > > library. > > > > But neither DRD nor Helgrind cannot cope with this binary: > > > > drd: drd_thread.c:584 (vgDrd_thread_set_vg_running_tid): Assertion > > 'vg_tid != VG_INVALID_THREADID' failed. > > ==68403== at 0xF009DCBD: ??? > > ==68403== by 0xF009DF71: ??? > > ... > > > > sched status: > > running_tid=0 > > > > Thread 1: status = VgTs_WaitSys > > ==68403== at 0x7DDC62: ioctl (in /usr/lib/libSystem.B.dylib) > > ==68403== by 0x7EB00A: __smakebuf (in /usr/lib/libSystem.B.dylib) > > ==68403== by 0x7EAF0C: __swsetup (in /usr/lib/libSystem.B.dylib) > > ==68403== by 0x7BAF8D: __sfvwrite (in /usr/lib/libSystem.B.dylib) > > ==68403== by 0x82618F: puts (in /usr/lib/libSystem.B.dylib) > > ==68403== by 0x1D0E: Printer::Print() (in > > /Users/glider/src/worker_vex_test/nsop) > > ==68403== by 0x1BAD: main (in /Users/glider/src/worker_vex_test/nsop) > > > > Thread 2: status = VgTs_Init > > ==68403== at 0x81E2A4: start_wqthread (in /usr/lib/libSystem.B.dylib) > > > > > > Looks like Valgrind tries to execute code in a previously unknown > > thread without calling the pre_thread_ll_create method for this > > thread. > > > > Does anyone know whether this is a real bug in VEX or just a > > NSOperationQueue misuse? > > First guess: either Valgrind or those tools aren't correctly handling the > thread-creation mechanisms used by NSOperationQueue. Work queues don't go > through the normal thread entry points. > You mean that NSOperationQueue can create a thread w/o calling pthread_create()? Than yes, the tools don't know anything about that. Could you point to any piece of documentation and/or source code which explains how threads are created by NSOperationQueue? Thanks, --kcc > > > -- > Greg Parker gp...@ap... Runtime Wrangler > > > > > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > |