|
2014-06-20
| ||
| 05:14 | [b47b176adf] Stop possible segfaults when variability in mutex lock schedules cause a ForwardingResu... check-in: 767aa6e893 user: aku tags: trunk | |
| 05:05 | [b47b176adf] Stop possible segfaults when variability in mutex lock schedules cause a ForwardingResu... check-in: bc8631546c user: aku tags: core-8-5-branch | |
|
2014-06-19
| ||
| 16:54 | • Ticket [b47b176adf] iortrans.tf-11.0 segfault status still Closed with 5 oth... artifact: 7da6d08250 user: aku | |
| 16:39 | • Closed ticket [b47b176adf]. artifact: f4df7f63bf user: dgp | |
| 16:38 | [b47b176adf] Stop segfault when variability in mutex lock schedules cause a ForwardingResult to rem... check-in: bbbfa372e6 user: dgp tags: trunk | |
| 16:31 | • Ticket [b47b176adf] iortrans.tf-11.0 segfault status still Open with 3 other... artifact: 897c711e11 user: dgp | |
| 15:44 | • Ticket [b47b176adf]: 3 changes artifact: 9502f0254f user: dgp | |
|
2014-06-18
| ||
| 20:38 | • Add attachment rtrans-forwarding.txt to ticket [b47b176adf7c3368|b47b17... artifact: 26bdbd924f user: aku | |
| 19:55 | • Ticket [b47b176adf] iortrans.tf-11.0 segfault status still Open with 3 other... artifact: be269c7503 user: aku | |
| 14:11 | • Ticket [b47b176adf]: 5 changes artifact: a583aa8a9e user: dgp | |
| 13:06 | • New ticket [b47b176adf]. artifact: e2977edcf0 user: dgp | |
iortrans.tf-11.0 segfault
Closed / Fixedb47b176adf7c33681946162ba6a171281ff8381eCreated 12 years agoUpdated 12 years ago
Descriptionplain2014-06-18 13:06:53
Not every time, but if the test iortrans.tf-11.0
is forced to run again and again, eventually it
will fail with a segfault:
---- iortrans.tf-11.0 start
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaaae910940 (LWP 24638)]
0x0000000000542697 in DeleteThreadReflectedTransformMap (clientData=0x0)
at /home/dgp/fossil/tcl/generic/tclIORTrans.c:2353
2353 paramPtr = evPtr->param;
(gdb) print evPtr
$1 = (ForwardingEvent *) 0x0
Referenced by3
767aa6e893[b47b176adf] Stop possible segfaults when variability in mutex lock schedules cause a ForwardingResult to remain on the forwardList after it has been processed (IORChan is the origin of the code in IORTrans). check-in2014-06-20 05:14:43bc8631546c[b47b176adf] Stop possible segfaults when variability in mutex lock schedules cause a ForwardingResult to remain on the forwardList after it has been processed (IORChan is the origin of the code in IORTrans). check-in2014-06-20 05:05:21bbbfa372e6[b47b176adf] Stop segfault when variability in mutex lock schedules cause a ForwardingResult to remain on the forwardList after it has been processed. check-in2014-06-19 16:38:33
dgpplain2014-06-18 14:11:39
(gdb) bt
#0 0x0000000000542697 in DeleteThreadReflectedTransformMap (clientData=0x0)
at /home/dgp/fossil/tcl/generic/tclIORTrans.c:2353
#1 0x00000000004ffbcf in Tcl_FinalizeThread ()
at /home/dgp/fossil/tcl/generic/tclEvent.c:1294
#2 0x000000000057fb58 in Tcl_ExitThread (status=0)
at /home/dgp/fossil/tcl/generic/tclThread.c:470
#3 0x00000000004fff9e in NewThreadProc (clientData=0xa44df0)
at /home/dgp/fossil/tcl/generic/tclEvent.c:1559
#4 0x0000003ddb00683d in start_thread () from /lib64/libpthread.so.0
#5 0x0000003dda4d526d in clone () from /lib64/libc.so.6
Passing to aku, in hopes he understands the management
of the "forwardList" so I don't have to digest it.
akuplain2014-06-18 19:55:33
A quick note, the forwarding code in IORTrans should be identical to the forwarding code in tclIORChan. Bugs in one are likely in the other as well.
dgpplain2014-06-19 15:44:31
In the segfaulting run, the Tcl_ConditionWait() call doesn't return.
dgpplain2014-06-19 16:31:27
It appears that the code is written making the assumption that when ConditionNotify is called and the the mutex is unlocked, that the next thing that will lock the mutex is the ConditionWait. That doesn't have to be true. In the failing case, ForwardOpToOwnerThread() in thread 1 placed a ForwardingResult on the forwardList and then waited in a ConditionWait. Then in thread 2 a [thread::exit] happens, which first leads to a call to DeleteReflectedTransformMap() when an interp in thread 2 is being torn down. This calls ForwardSetStaticError() and then ConditionNotify() and unlocks the mutex. If at this point, as often happens, thread 1 were to wake up and take over, it would pull the now-dead ForwardingResult off the forwardList, and all would be well.... ....however, it can and sometimes does happen, that the next lock on the mutex will be acquired by thread 2 as it continues tearing down the thread, and now is in the call of DeleteThreadReflectedTransformMap(). The ForwardingResult is still on the forwardList, but now has resultPtr->evPtr == NULL, which leads to the crash. What must change is that no code processing the items on the forwardList can assume that just because a resultPtr is on the list, it must have a non-NULL resultPtr->evPtr. Fortunately that's an easy fix. Just check for NULL and continue when it is seen.
dgpplain2014-06-19 16:39:10
fixed on trunk.
akuplain2014-06-19 16:54:32
Thank you for the analysis and fix. I will think on a suitable comment to add to the code to point out this variability (i.e. that DeleteReflectedTransformMap() may be followed by DeleteThreadReflectedTransformMap() instead of the originator thread handling it. Will see if I can take the time to fix the same issue in tclIORChan.c (8.5 first, then trunk).
Log in (anonymous is fine) to add a comment.
Attachments:
- rtrans-forwarding.txt [download] added by aku on 2014-06-18 20:38:43. [details]