|
2024-09-19
| ||
| 10:05 | Merge [8e0ee072e2857992]: [708422] Nice test case. Bug report duplicates [7842f33a5c]. check-in: 71e5b88a95 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2024-09-16
| ||
| 16:05 | [708422] Nice test case. Bug report duplicates [7842f33a5c] check-in: be14e8b90e user: dkf tags: core-8-branch | |
| 15:58 | • Pending ticket [708422a066]: unset traces enable calling an object command mid-d... artifact: 717fa13bde user: dkf | |
|
2024-08-28
| ||
| 19:40 | Merge [aed7d249ae9b8afe]: Amend [de08cf03235f3ce9], [7842f33a5cc5eed0]: Stop tail recursion in AddSi... check-in: 6e253eb8db user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
| 19:38 | Merge [28a69010d739e066]: Small amendment to [1d16344c8cfaecc8], [7842f33a5cc5eed0]: don't need to i... check-in: 6976747c09 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
| 17:16 | Merge [780ab5652536fa8c]: Circumvent crash [7842f33a5cc5eed0] on null ptr (oPtr->selfCls may be NULL... check-in: 83523382e8 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2024-05-23
| ||
| 10:33 | • Closed ticket [7842f33a5c]: TCL crash (core) plus 6 other changes artifact: 2fb5ef5ad5 user: dkf | |
|
2024-05-22
| ||
| 13:42 | • Ticket [7842f33a5c]: 3 changes artifact: 0a71d415a5 user: apnadkarni | |
| 10:53 | • Ticket [7842f33a5c]: 3 changes artifact: 98645273ef user: sebres | |
| 10:50 | amend to [de08cf03235f3ce9], [7842f33a5cc5eed0], stop tail recursion in AddSimpleClassChainToCallCon... check-in: 22966032c2 user: sebres tags: core-8-branch | |
| 10:11 | small amend to [1d16344c8cfaecc8], [7842f33a5cc5eed0]: don't need to invoke both functions in case i... check-in: 659ca0ae8d user: sebres tags: core-8-branch | |
| 03:40 | • Ticket [7842f33a5c] TCL crash (core) status still Open with 3 other changes artifact: 0116b6cf56 user: apnadkarni | |
|
2024-05-21
| ||
| 12:35 | • Ticket [7842f33a5c]: 4 changes artifact: 747c9d49bb user: oehhar | |
| 10:49 | circumvent crash [7842f33a5cc5eed0] on null ptr (oPtr->selfCls may be NULL) check-in: 1d16344c8c user: sebres tags: core-8-branch | |
| 08:37 | • Ticket [7842f33a5c] TCL crash (core) status still Open with 3 other changes artifact: 1571188edf user: jan.nijtmans | |
|
2024-05-20
| ||
| 20:53 | • Open ticket [7842f33a5c]. artifact: 8bbe17b992 user: jan.nijtmans | |
| 20:20 | Fix [7842f33a5c]: Call chain creation could crash in destructors in some tangled cases closed check-in: a93beaf43c user: jan.nijtmans tags: mistake | |
| 15:20 | Fix [7842f33a5c]: Call chain creation could crash in destructors in some tangled cases check-in: de08cf0323 user: dkf tags: core-8-branch | |
| 15:18 | • Closed ticket [7842f33a5c]: TCL crash (core) plus 4 other changes artifact: fa0b8ec6b3 user: dkf | |
| 15:18 | Fix [7842f33a5c]: Call chain creation could crash in destructors in some tangled cases check-in: 8b4a3295ed user: dkf tags: core-8-6-branch | |
| 15:16 | • Ticket [7842f33a5c] TCL crash (core) status still Open with 3 other changes artifact: 7385169a2f user: dkf | |
| 15:16 | • Ticket [7842f33a5c]: 3 changes artifact: c69bb1bae4 user: dkf | |
| 15:09 | Fix for [7842f33a5c]: Stereotype call chains were ending up bogus in some situations closed check-in: b0e486eaa6 user: dkf tags: bug-7842f33a5c | |
| 13:51 | • Ticket [7842f33a5c] TCL crash (core) status still Open with 3 other changes artifact: 715f32ddd6 user: dkf | |
| 13:38 | Test case to demonstrate [7842f33a5c] check-in: b7a6626f60 user: dkf tags: bug-7842f33a5c | |
| 13:37 | • Ticket [7842f33a5c] TCL crash (core) status still Open with 4 other changes artifact: 65a51edf8d user: dkf | |
| 13:36 | • Ticket [7842f33a5c]: 4 changes artifact: b337ceecf0 user: dkf | |
|
2023-10-22
| ||
| 16:41 | • Ticket [7842f33a5c]: 3 changes artifact: ca867048e7 user: chrstphrchvz | |
|
2023-07-08
| ||
| 12:23 | • Ticket [7842f33a5c]: 4 changes artifact: 8d00e24e79 user: chrstphrchvz | |
|
2022-08-27
| ||
| 21:39 | • New ticket [7842f33a5c]. artifact: 42083508d2 user: anonymous | |
TCL crash (core)
The following script will CRASH tcl
TWO instances are linked together, the second instance uses in the destructor the first instance. but the second instance is created in the namespace of the first instance. if the first instance is deleted the destructor of the second instance is called and this is calling the first instance again etc…
oo::class create RpcClient {
}
oo::define RpcClient method write {name } {
puts "RpcClient → $name"
}
oo::class create LcConfigRpcClient {
superclass RpcClient
}
oo::define LcConfigRpcClient method LcConfigRpc_create_bug {name } {
LcConfigRpc create $name [self] 111
}
oo::define LcConfigRpcClient export LcConfigRpc_create_bug
oo::class create MkObjectRpc {
variable hdl
}
oo::define MkObjectRpc constructor {rpcHdl mqHdl} {
set hdl $mqHdl
oo::objdefine [self] forward rpc $rpcHdl
}
oo::define MkObjectRpc destructor {
my rpc write otto-$hdl
}
oo::class create LcConfigRpc {
superclass MkObjectRpc
variable hdl
}
set FH [LcConfigRpcClient new]
$FH LcConfigRpc_create_bug cfg
$FH destroy
71e5b88a95Merge [8e0ee072e2857992]: [708422] Nice test case. Bug report duplicates [7842f33a5c]. check-in2024-09-19 10:05:32be14e8b90e[708422] Nice test case. Bug report duplicates [7842f33a5c] check-in2024-09-16 16:05:35717fa13bdePending ticket [708422a066]: unset traces enable calling an object command mid-destruction plus 5 other changes ticket2024-09-16 15:58:21a93beaf43cFix [7842f33a5c]: Call chain creation could crash in destructors in some tangled cases check-in2024-05-20 20:20:26de08cf0323Fix [7842f33a5c]: Call chain creation could crash in destructors in some tangled cases check-in2024-05-20 15:20:308b4a3295edFix [7842f33a5c]: Call chain creation could crash in destructors in some tangled cases check-in2024-05-20 15:18:18b0e486eaa6Fix for [7842f33a5c]: Stereotype call chains were ending up bogus in some situations check-in2024-05-20 15:09:01b7a6626f60Test case to demonstrate [7842f33a5c] check-in2024-05-20 13:38:38
Changing subsystem to TclOO; the “Objects” subsystem is meant for Tcl values in general.
The reporter’s example still crashes for core-8-6-branch. UBSan (-fsanitize=null) and ASan (-fsanitize=address) errors:
A NULL+0xf0 dereference at tclOOCall.c:1024 would mean that oPtr->selfCls is NULL.tcl/generic/tclOOCall.c:1024:25: runtime error: member access within null pointer of type 'struct Class' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tcl/generic/tclOOCall.c:1024:25 in AddressSanitizer:DEADLYSIGNAL ================================================================= ==65360==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000000f0 (pc 0x0001109f36a5 bp 0x7ff7b1f52830 sp 0x7ff7b1f51c80 T0) ==65360==The signal is caused by a READ memory access. ==65360==Hint: address points to the zero page. #0 0x1109f36a5 in TclOOGetCallContext tclOOCall.c:1024 #1 0x1109be8b2 in TclOOObjectCmdCore tclOO.c:2599 #2 0x1109cd36d in PublicNRObjectCmd tclOO.c:2461 #3 0x10fa83837 in Dispatch tclBasic.c:4520 #4 0x10fa63bbf in TclNRRunCallbacks tclBasic.c:4556 #5 0x10fa52ad3 in Tcl_NRCallObjProc tclBasic.c:8269 #6 0x1109c8db5 in ObjectNamespaceDeleted tclOO.c:1141 #7 0x1106b22dd in Tcl_DeleteNamespace tclNamesp.c:917 #8 0x1109cd534 in ObjectRenamedTrace tclOO.c:844 #9 0x10fa57e58 in CallCommandTraces tclBasic.c:3426 #10 0x10fa4d7e7 in Tcl_DeleteCommandFromToken tclBasic.c:3226 #11 0x1106ba16e in TclTeardownNamespace tclNamesp.c:1124 #12 0x1106b3857 in Tcl_DeleteNamespace tclNamesp.c:1011 #13 0x1109cd534 in ObjectRenamedTrace tclOO.c:844 #14 0x10fa57e58 in CallCommandTraces tclBasic.c:3426 #15 0x10fa4d7e7 in Tcl_DeleteCommandFromToken tclBasic.c:3226 #16 0x1109d4b98 in TclOO_Object_Destroy tclOOBasic.c:361 #17 0x1109eb8c0 in TclOOInvokeContext tclOOCall.c:314 #18 0x1109c0400 in TclOOObjectCmdCore tclOO.c:2645 #19 0x1109cd36d in PublicNRObjectCmd tclOO.c:2461 #20 0x10fa83837 in Dispatch tclBasic.c:4520 #21 0x10fa63bbf in TclNRRunCallbacks tclBasic.c:4556 #22 0x10fa76fdf in TclEvalObjEx tclBasic.c:6138 #23 0x10fa5f951 in Tcl_EvalObjEx tclBasic.c:6119 #24 0x110510fa2 in Tcl_RecordAndEvalObj tclHistory.c:191 #25 0x1106ab031 in Tcl_MainEx tclMain.c:520 #26 0x10dfab8d6 in main tclAppInit.c:91 #27 0x11a14552d in start+0x1cd (dyld:x86_64+0x552d)==65360==Register values: rax = 0x00000000000000f0 rbx = 0x00007ff7b1f51d80 rcx = 0x0000100000000000 rdx = 0x0000000000000000 rdi = 0x00007ff7b1f50f70 rsi = 0x0000000000000000 rbp = 0x00007ff7b1f52830 rsp = 0x00007ff7b1f51c80 r8 = 0x0000000000000057 r9 = 0xbfffff00000fffff r10 = 0x00007ff809a2059e r11 = 0x0000000000000202 r12 = 0x000000011a1c03a0 r13 = 0x00007ff7b1f57a58 r14 = 0x000000010dfab898 r15 = 0x000000011a1ac010 AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV tclOOCall.c:1024 in TclOOGetCallContext ==65360==ABORTING
Stripped down further (from a test case I'm developing):
oo::class create RpcClient {
method write name {
lappend ::result "RpcClient -> $name"
}
method create_bug {} {
MkObjectRpc create cfg [self] 111
}
}
oo::class create MkObjectRpc {
variable hdl
constructor {rpcHdl mqHdl} {
set hdl $mqHdl
oo::objdefine [self] forward rpc $rpcHdl
}
destructor {
my rpc write otto-$hdl
}
}
set FH [RpcClient new]
$FH create_bug
$FH destroy
Have confirmed that this is a current issue in both 8.6 and trunk.
Debug-annotated stack trace
#0 TclOOGetCallContext (oPtr=0x1d1190, methodNameObj=0x15f510, flags=1, cacheInThisObj=0x15f510)
at C:/Users/ZZALSDKF/code/tcl/generic/tclOOCall.c:1024
#1 0x00007ffae26a8812 in TclOOObjectCmdCore (oPtr=0x1d1190, interp=0x11d6d0, objc=3,
objv=0x12afb0, flags=1, startCls=0x0) at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:2599
#2 0x00007ffae26a83d7 in PublicNRObjectCmd (clientData=0x1d1190, interp=0x11d6d0, objc=3,
objv=0x12afb0) at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:2461
#3 0x00007ffae256f4b1 in Dispatch (data=0x163f58, interp=0x11d6d0, result=0)
at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:4503
#4 0x00007ffae256f546 in TclNRRunCallbacks (interp=0x11d6d0, result=0, rootPtr=0x15fc00)
at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:4539
#5 0x00007ffae2575294 in Tcl_NRCallObjProc (interp=0x11d6d0,
objProc=0x7ffae26ac3bd <TclOOInvokeContext>, clientData=0x12ae20, objc=0, objv=0x0)
at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:8235
#6 0x00007ffae26a562a in ObjectNamespaceDeleted (clientData=0x1d1790)
at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:1141
#7 0x00007ffae269c70b in Tcl_DeleteNamespace (namespacePtr=0x1ddd20)
at C:/Users/ZZALSDKF/code/tcl/generic/tclNamesp.c:919
#8 0x00007ffae26a4ba8 in ObjectRenamedTrace (clientData=0x1d1790, interp=0x11d6d0,
oldName=0x1cebe0 "::oo::Obj14::cfg", newName=0x0, flags=16512)
at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:844
#9 0x00007ffae256d9c7 in CallCommandTraces (iPtr=0x11d6d0, cmdPtr=0x1d1890,
oldName=0x1cebe0 "::oo::Obj14::cfg", newName=0x0, flags=16512)
at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:3409
#10 0x00007ffae256d600 in Tcl_DeleteCommandFromToken (interp=0x11d6d0, cmd=0x1d1890)
at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:3209
#11 0x00007ffae269cb46 in TclTeardownNamespace (nsPtr=0x1dd920)
at C:/Users/ZZALSDKF/code/tcl/generic/tclNamesp.c:1127
#12 0x00007ffae269c927 in Tcl_DeleteNamespace (namespacePtr=0x1dd920)
at C:/Users/ZZALSDKF/code/tcl/generic/tclNamesp.c:1014
#13 0x00007ffae26a4ba8 in ObjectRenamedTrace (clientData=0x1d1190, interp=0x11d6d0,
oldName=0x17e6c0 "::oo::Obj14", newName=0x0, flags=16512)
at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:844
#14 0x00007ffae256d9c7 in CallCommandTraces (iPtr=0x11d6d0, cmdPtr=0x1d1290,
oldName=0x17e6c0 "::oo::Obj14", newName=0x0, flags=16512)
at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:3409
#15 0x00007ffae256d600 in Tcl_DeleteCommandFromToken (interp=0x11d6d0, cmd=0x1d1290)
at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:3209
#16 0x00007ffae26aa08f in TclOO_Object_Destroy (clientData=0x0, interp=0x11d6d0, context=0x12adf0,
objc=2, objv=0x12add0) at C:/Users/ZZALSDKF/code/tcl/generic/tclOOBasic.c:361
The problem was in the computation of stereotypical call chains when the object in question had already gone rather a long way through the destruction process. Nasty!
Things no longer crash, but if you want to get the MkObjectRpc destructor to run and successfully call into the RpcClient write method, you'd better explicitly destroy the object created by LcConfigRpc_create_bug in the LcConfigRpcClient destructor. Without that, there's just slightly too much state ripped out of the way of things by the point when destruction happens and TclOO instead builds empty call chains (resulting in calls doing nothing; normally calls to non-existent methods result in call chains that go to the unknown method handler, in oo::object if not overridden).
---- oo-35.7.1 start Test file error: child killed: segmentation violation Something is still wrong
The 8.6 build succeeded, the 8.7 build failed on all platforms.
@dkf please have a look.
Magic Sergey has fixed the crash reported below by commit [1d16344c8c]. Thank you all, great team, Harald
While the crash may be fixed, it is not clear to me how things get into that state and if there is an underlying fault in the call chain computation that is hidden. Still worth Donal also taking a look imo.
Well, the case where The fact that it fails in 8.7+ but not in 8.6 is easy to explain: in 8.6 since [b0e486eaa693a6a6] Now this is fixed everywhere (I also restored the mentioned check in [22966032c2912825]), additionally the invocation of oPtr->selfCls may be NULL is normal case, related to the code (even fix of dkf for other pieces [8b4a3295ed9e537c] shows such conditions check).
AddSimpleClassChainToCallContext checks whether classPtr == NULL (direct after tailRecurse label), where in 8.7+ this check was lost (probably due to some conflicts or because it was backported to AddPrivatesFromClassChainToCallContext only, which doesn't exist in 8.6)... Therefore the new tests oo-35.7.* didn't fail in 8.6, but in 8.7+ (I guess Donal simply merged it to 8.7 in [de08cf03235f3ce9], but didn't test it there).
AddSimpleClassChainToCallContext and AddPrivatesFromClassChainToCallContext is avoided completely if oPtr->selfCls is NULL (totally unneeded and wouldn't crash if later both would be rewritten again).
Thanks for the explanation Sergey.
Thanks for fixing that.