|
2016-01-19
| ||
| 13:09 | • Closed ticket [593baa032c]: superclass refcount error? plus 7 other changes artifact: 7e383dca64 user: dgp | |
| 13:08 | [593baa032c] Stop segfault in class destruction with active namespace. check-in: b59cda3924 user: dgp tags: trunk | |
|
2016-01-08
| ||
| 16:06 | • Ticket [593baa032c] superclass refcount error? status still Open with 4 othe... artifact: e29b34eea2 user: dgp | |
|
2015-12-22
| ||
| 20:36 | • Ticket [593baa032c]: 3 changes artifact: 2e7b5ef6e7 user: dgp | |
| 19:50 | [593baa032c] Additional fix for the mixinSubs list. check-in: 13d2b84536 user: dgp tags: bug-593baa032c | |
| 19:04 | • Ticket [593baa032c] superclass refcount error? status still Open with 3 othe... artifact: 311dee15e3 user: dgp | |
| 18:44 | • Ticket [593baa032c]: 3 changes artifact: 8b643e18db user: dgp | |
| 18:27 | [593baa032c] Possible fix (with test) for segfault in superclass teardown. check-in: 9a6b136330 user: dgp tags: bug-593baa032c | |
| 16:53 | • Ticket [593baa032c] superclass refcount error? status still Open with 3 othe... artifact: 2dd7e82f76 user: dgp | |
|
2015-12-18
| ||
| 19:51 | • Ticket [593baa032c]: 3 changes artifact: c1e51abd64 user: dgp | |
| 19:25 | • Ticket [593baa032c]: 3 changes artifact: 201f8eb328 user: dgp | |
| 15:50 | • Ticket [593baa032c]: 4 changes artifact: 3762b5bd85 user: dkf | |
| 14:41 | • Ticket [593baa032c]: 3 changes artifact: c5d9e7e210 user: dgp | |
| 14:41 | • New ticket [593baa032c]. artifact: b7deee9f7b user: dgp | |
superclass refcount error?
Closed / Fixed593baa032c3b03473e21c828e215e4b9a67b6df6Created 11 years agoUpdated 11 years ago
Descriptionplain2015-12-18 14:41:30
Using the trunk of Tcl and the trunk of Itcl, this script
segfaults:
package require Itcl
::itcl::class C {method m {} {::oo::class destroy}}
[C c] m
This might be Itcl's fault, but the backtrace suggests
TclOO is not getting its refcounting right in its superclass
list:
Program received signal SIGSEGV, Segmentation fault.
0x000000000059b0f9 in ObjectNamespaceDeleted (clientData=0x97f298)
at /home/dgp/fossil/tcl/generic/tclOO.c:1228
1228 if (!Deleted(superPtr->thisPtr)) {
Missing separate debuginfos, use: debuginfo-install glibc-2.17-106.el7_2.1.x86_64 zlib-1.2.7-15.el7.x86_64
(gdb) bt
#0 0x000000000059b0f9 in ObjectNamespaceDeleted (clientData=0x97f298)
at /home/dgp/fossil/tcl/generic/tclOO.c:1228
#1 0x0000000000542eba in TclTeardownNamespace (nsPtr=0x9282b8)
at /home/dgp/fossil/tcl/generic/tclNamesp.c:1220
#2 0x0000000000542b90 in Tcl_DeleteNamespace (namespacePtr=0x9282b8)
at /home/dgp/fossil/tcl/generic/tclNamesp.c:1028
#3 0x0000000000541f3e in Tcl_PopCallFrame (interp=0x822378)
at /home/dgp/fossil/tcl/generic/tclNamesp.c:421
#4 0x000000000055e277 in InterpProcNR2 (data=0x9aed80, interp=0x822378,
result=0) at /home/dgp/fossil/tcl/generic/tclProc.c:1869
#5 0x0000000000414cf8 in TclNRRunCallbacks (interp=0x822378, result=0,
rootPtr=0x0) at /home/dgp/fossil/tcl/generic/tclBasic.c:4386
#6 0x000000000041454c in Tcl_EvalObjv (interp=0x822378, objc=2,
objv=0x8259f0, flags=2097168)
at /home/dgp/fossil/tcl/generic/tclBasic.c:4116
#7 0x00000000004169e6 in TclEvalEx (interp=0x822378,
script=0x8ecba8 "load ./libitcl4.0.3.so\npackage require Itcl\n::itcl::class C {method m {} {::oo::class destroy}}\n[C c] m\n", numBytes=104, flags=0,
line=4, clNextOuter=0x0,
outerScript=0x8ecba8 "load ./libitcl4.0.3.so\npackage require Itcl\n::itcl::class C {method m {} {::oo::class destroy}}\n[C c] m\n")
at /home/dgp/fossil/tcl/generic/tclBasic.c:5255
#8 0x000000000053687b in Tcl_FSEvalFileEx (interp=0x822378, pathPtr=0x8d9468,
encodingName=0x0) at /home/dgp/fossil/tcl/generic/tclIOUtil.c:1827
#9 0x0000000000540f2a in Tcl_MainEx (argc=-1, argv=0x7fffffffd668,
appInitProc=0x40f456 <Tcl_AppInit>, interp=0x822378)
at /home/dgp/fossil/tcl/generic/tclMain.c:420
#10 0x000000000040f44f in main (argc=2, argv=0x7fffffffd658)
at /home/dgp/fossil/tcl/unix/tclAppInit.c:84
Referenced by3
b59cda3924[593baa032c] Stop segfault in class destruction with active namespace. check-in2016-01-19 13:08:4913d2b84536[593baa032c] Additional fix for the mixinSubs list. check-in2015-12-22 19:50:049a6b136330[593baa032c] Possible fix (with test) for segfault in superclass teardown. check-in2015-12-22 18:27:23
dgp Ticket [593baa032c]: 3 changes
[History diff]2015-12-18 14:41:49
dkfhtml2015-12-18 15:50:03
Yet this works fine (mem-debugging enabled build, commit c5394a312b):
% oo::class create C {method m {} {::oo::class destroy}}
::C
% [C create c] m
%
Whatever is going on is subtle.
dgpplain2015-12-18 19:25:09
Here's a script with only Tcl causing the same segfault:
oo::class create R {}
oo::class create Z {superclass ::oo::class}
oo::define ::oo::class export createWithNamespace
Z createWithNamespace C C
oo::define C superclass R
oo::define C method m {} {
namespace eval ::C {
::oo::class destroy
}
}
C create c
c m
dgpplain2015-12-18 19:51:18
Simpler demo that segfaults a memdebug enabled Tcl shell:
% oo::class create R
::R
% oo::class create C {
superclass R
method m ns {namespace eval $ns {::oo::class destroy}}
}
::C
% C create c
::c
% c m [info object namespace C]
make: *** [shell] Segmentation fault
dgpplain2015-12-22 16:53:35
Another simplification round. Don't need to tear down the whole world.
% oo::class create B {}
::B
% oo::class create D {superclass B}
::D
% namespace eval [info object namespace D] {::B destroy}
make: *** [shell] Segmentation fault
dgpplain2015-12-22 18:44:54
See branch bug-593baa032c for possible fix. Needs review. Also the buggy pattern seen here with the superclass list seems to also be present in the mixins list guiding calls to TclOORemoveFromMixinSubs().
dgpplain2015-12-22 19:04:04
Indeed:
% oo::class create B {}
::B
% oo::class create D {mixin B}
::D
% namespace eval [info object namespace D] {::B destroy}
make: *** [shell] Segmentation fault
dgpplain2015-12-22 20:36:08
fix for that included now on branch too
dgpplain2016-01-08 16:06:42
Any chance this might get a review soon?
dgpplain2016-01-19 13:09:33
Would rather have under-reviewed fix than no fix at all.
Log in (anonymous is fine) to add a comment.