Skip to content
Tcl Source Code Artifact [38057088b7]
Login

Artifact [38057088b7]

Artifact 38057088b7cebb671c8dbe398a6c46cb9de087b2:

Ticket change [38057088b7] - New ticket [3048057fffffffff|3048057fff] <i>race in Tcl_MutexLock ?</i>. by dgp on 2010-08-18 20:20:45.
D 2010-08-18T20:20:45
J assignee andreas_kupries
J cmimetype text/plain
J comment \nA\scolleague\sis\sdebugging\sthread\sissues\sin\na\sprogram\sthat\suses\sTcl's\scollection\sof\s\nthread-related\sroutines\sas\sa\scross-platform\nthreading\slibrary.\s\sWhen\susing\sthe\sGoogle\ntool\s"ThreadSanitizer"\sto\sexamine\sthe\sprogram\n\nhttp://code.google.com/p/data-race-test/wiki/ThreadSanitizer\n\na\sreport\scomes\sback\sclaiming\sthat\sthe\sdouble\scheck\nlocking\sscheme\sin\sTcl_MutexLock\sis\ssusceptible\sto\sa\nrace\scondition.\s\sSome\slinks\son\sthe\ssubject:\n\nhttp://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf\nhttp://bartoszmilewski.wordpress.com/2008/11/05/who-ordered-memory-fences-on-an-x86/\n\nThe\soutput\sfrom\sThreadSanitizer:\n\n==6800==\sINFO:\sT2\shas\sbeen\screated\sby\sT0.\sUse\s--announce-threads\sto\ssee\sthe\screation\sstack.\n==6800==\sINFO:\sT3\shas\sbeen\screated\sby\sT0.\sUse\s--announce-threads\sto\ssee\sthe\screation\sstack.\n==6800==\sWARNING:\sPossible\sdata\srace\sduring\sread\sof\ssize\s8\sat\s0x7FFEFF1D68:\s{{{\n==6800==\s\s\s\sT3\s(L{}):\n==6800==\s\s\s\s\s#0\s\sTcl_MutexLock\s/local/home/donahue/ftp/tmp/tcl8.5.8/unix/../unix/tclUnixThrd.c:519\n==6800==\s\s\s\s\s#1\s\sOxs_Mutex::Lock()\s/local/home/donahue/nobackup/tmp/valgrind/oommf/app/oxs/base/oxsthread.h:76\n==6800==\s\s\s\s\s#2\s\sOxs_ThreadControl::Lock()\s/local/home/donahue/nobackup/tmp/valgrind/oommf/app/oxs/base/oxsthread.h:166\n==6800==\s\s\s\s\s#3\s\s_Oxs_ThreadBush_main(void*)\s/local/home/donahue/nobackup/tmp/valgrind/oommf/app/oxs/base/oxsthread.cc:652\n==6800==\s\s\s\s\s#4\s\sNewThreadProc\s/local/home/donahue/ftp/tmp/tcl8.5.8/unix/../generic/tclEvent.c:1487\n==6800==\s\s\s\s\s#5\s\sThreadSanitizerStartThread\s/b/slave/full_linux_build/build/tsan/ts_valgrind_intercepts.c:609\n==6800==\s\s\sConcurrent\swrite(s)\shappened\sat\s(OR\sAFTER)\sthese\spoints:\n==6800==\s\s\s\sT2\s(L{L3}):\n==6800==\s\s\s\s\s#0\s\sTcl_MutexLock\s/local/home/donahue/ftp/tmp/tcl8.5.8/unix/../unix/tclUnixThrd.c:528\n==6800==\s\s\s\s\s#1\s\sOxs_Mutex::Lock()\s/local/home/donahue/nobackup/tmp/valgrind/oommf/app/oxs/base/oxsthread.h:76\n==6800==\s\s\s\s\s#2\s\sOxs_ThreadControl::Lock()\s/local/home/donahue/nobackup/tmp/valgrind/oommf/app/oxs/base/oxsthread.h:166\n==6800==\s\s\s\s\s#3\s\s_Oxs_ThreadBush_main(void*)\s/local/home/donahue/nobackup/tmp/valgrind/oommf/app/oxs/base/oxsthread.cc:652\n==6800==\s\s\s\s\s#4\s\sNewThreadProc\s/local/home/donahue/ftp/tmp/tcl8.5.8/unix/../generic/tclEvent.c:1487\n==6800==\s\s\s\s\s#5\s\sThreadSanitizerStartThread\s/b/slave/full_linux_build/build/tsan/ts_valgrind_intercepts.c:609\n==6800==\s\s\sLocation\s0x7FFEFF1D68\sis\s62096\sbytes\sinside\sT0's\sstack\s[0x7FFE000FF8,0x7FFF000FF8]\n==6800==\s\s\sLocks\sinvolved\sin\sthis\sreport\s(reporting\slast\slock\ssites):\s{L3}\n==6800==\s\s\s\sL3\s(0x5334900)\n==6800==\s\s\s\s\s#0\s\spthread_mutex_lock\s/b/slave/full_linux_build/build/tsan/ts_valgrind_intercepts.c:850\n==6800==\s\s\s\s\s#1\s\sTcl_MutexLock\s/local/home/donahue/ftp/tmp/tcl8.5.8/unix/../unix/tclUnixThrd.c:520\n==6800==\s\s\s\s\s#2\s\sOxs_Mutex::Lock()\s/local/home/donahue/nobackup/tmp/valgrind/oommf/app/oxs/base/oxsthread.h:76\n==6800==\s\s\s\s\s#3\s\sOxs_ThreadControl::Lock()\s/local/home/donahue/nobackup/tmp/valgrind/oommf/app/oxs/base/oxsthread.h:166\n==6800==\s\s\s\s\s#4\s\s_Oxs_ThreadBush_main(void*)\s/local/home/donahue/nobackup/tmp/valgrind/oommf/app/oxs/base/oxsthread.cc:652\n==6800==\s\s\s\s\s#5\s\sNewThreadProc\s/local/home/donahue/ftp/tmp/tcl8.5.8/unix/../generic/tclEvent.c:1487\n==6800==\s\s\s\s\s#6\s\sThreadSanitizerStartThread\s/b/slave/full_linux_build/build/tsan/ts_valgrind_intercepts.c:609\n==6800==\s\s\s\sRace\sverifier\sdata:\s0x50F364A,0x50F3692\n==6800==\s}}}\n\nI\shave\sa\svague\ssense\sthat\sthis\sis\sa\sknown\sissue\salready,\nand\sthe\sthreading\sgurus\sin\sthe\sTcl\sworld\shave\ssome\sreason\nto\sbelieve\sit's\snot\sa\sreal\sproblem.\s\sPerhaps\sthe\sonly\snew\nissue\shere\sis\sthe\sexistence\sof\sa\stool\sthat\swill\spoint\sa\nfinger\sof\sblame\sat\sus,\sand\swhether\sthere's\sanyhting\sthat\ncan\sor\sshould\sbe\sdone\sabout\sthat.\n\n
J foundin obsolete:\s8.5.8
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter dgp
J subsystem 49.\sThreading
J title race\sin\sTcl_MutexLock\s?
J type Bug
K 3048057fffffffffffffffffffffffffffffffff
U dgp
Z 8b1b2472fdc58bf0d7fe0b6c72544dc3