Artifacts Associated With Ticket 3422267ed6b7
Ticket change [c887514b1a] (rid 185528) by pooryorick on 2020-08-12 12:54:58:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
The following script produces a segmentation fault in an interprter built with -DPURIFY and --enable-symobls-debug: <code><verbatim> variable res {} proc p1 args { return success } namespace eval ns1 { namespace export * } interp alias {} [namespace current]::ns1::p2 {} [namespace current]::p1 namespace eval ns2 { namespace import [namespace parent]::ns1::p2 } proc ondelete {oldname newname op} { variable res namespace delete ns1 catch { ns1::p2 } res } trace add command ns2::p2 delete [namespace which ondelete] rename ns2::p2 {} rename p1 {} </verbatim></code> The expected result is an error message about <code>ns1::p2</code> <code><verbatim> invalid command name "ns1::p2" </verbatim></code> The issue is that in <code>tclNamesp.c:DeleteImportedCmd</code>, <code>realCmdPtr</code> points to memory that has already been deallocated. For imported commands reference counting and cleanup is currently incomplete. - is_private initialized to: "0"
- login: "pooryorick"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "pooryorick"
- subsystem initialized to: "21. [namespace]"
- title initialized to:
segmentation fault from deleting the the target of an imported alias during a trace on the target of the alias
- type initialized to: "Bug"
Ticket change [31551b410a] (rid 185536) by pooryorick on 2020-08-12 13:29:21:
- icomment: "Fixed in [37243ff47659d65c]."
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
Ticket change [b07751bb73] (rid 185537) by pooryorick on 2020-08-12 13:32:25:
- icomment: "Body of test case in [2da1596304896026]"
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
Ticket change [5726b0cac3] (rid 185544) by pooryorick on 2020-08-12 18:15:32:
- icomment:
Further fixes in [de751a349009f88a] and [b9d1a1ce1aef55c3].
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [366d2ff816] (rid 185547) by jan.nijtmans on 2020-08-13 10:36:47:
- assignee changed to: "pooryorick"
- icomment:
When running the testsuite on MacOS (most likely on other platforms too): <pre> aaa_exit.test append.test appendComp.test Test file error: alloc: invalid block: 0x7fc0eb01f9d0: a0 ea apply.test Test file error: alloc: invalid block: 0x7ffdc801f9d0: d0 c7 assemble.test assocd.test async.test Test file error: alloc: invalid block: 0x7f81e801f9d0: 60 e7 autoMkindex.test .... </pre> Bisecting gives: <pre> 2020-08-12 13:35:00 9d087059ef BAD 2020-08-12 10:30:14 eab09ae8ff GOOD </pre> Suggestion: If you are able to fix this soon, please do so. Otherwise, please revert this change from core-8-branch and continue on your branch until this is fixed.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [c6b14f2161] (rid 185549) by jan.nijtmans on 2020-08-13 10:42:43:
- icomment:
Travis shows failing build on UNIX: [https://travis-ci.org/github/tcltk/tcl/jobs/717502919]
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [217a9e88d5] (rid 185551) by jan.nijtmans on 2020-08-13 12:46:42:
- icomment:
Uncomplete fix now reverted from core-8-branch, but bugfix branch left as-is
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [db5108fc04] (rid 185611) by pooryorick on 2020-08-16 17:43:20:
- icomment:
A missing reference count adjustment was added in [08e3b17c955f062d].
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [9295cd6f31] (rid 185612) by pooryorick on 2020-08-16 17:44:15:
- login: "pooryorick"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
Ticket change [06cf98c4fc] (rid 185624) by jan.nijtmans on 2020-08-18 13:26:27:
- icomment:
Please look at the Travis build of this 'fix': [https://travis-ci.org/github/tcltk/tcl/builds/718869670]. I'm sorry, but this shows that the solution is still not OK.
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "None"
- icomment:
Ticket change [96e208a519] (rid 185730) by pooryorick on 2020-08-28 09:38:12:
- icomment:
Fixed in commit [0af4ad496cd234d3]. The problem was that the <code>Command</code> structure for a lambda application is not allocated, but instead synthesized by <code>TclNRApplyObjCmd</code>. <code>tclProc.c/FreeLambdaInternalRep</code> calls <code>TclProcCleanupProc(procPtr)</code>, which tries to do cleanup on <code>procPtr->cmdPtr</code>. The solution is to set <code>procPtr->cmdPtr</code> to <code>NULL</code> before calling <code>TclProcCleanupProc</code>.
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- icomment:
Ticket change [06cb7ea3c3] (rid 185745) by jan.nijtmans on 2020-08-28 15:20:27:
- foundin changed to: "8.7"
- icomment:
Apparently, this report is for Tcl 8.7, so added that. This time all tests seem to pass. Congratulations! If Travis is content too, it can be merged to other branches.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Pending"
Ticket change [0fbe8390bc] (rid 185752) by pooryorick on 2020-08-29 09:01:15:
- closedate changed to: "2459090.87587203"
- closer changed to: "pooryorick"
- login: "pooryorick"
- mimetype: "text/plain"
- status changed to: "Closed"
Ticket change [3a16708111] (rid 185767) by jan.nijtmans on 2020-08-29 21:50:41:
- closedate changed to: "2459091.41019976"
- closer changed to: "jan.nijtmans"
- icomment:
Sorry, Travis fails for all "MemDebug" builds! See: [https://travis-ci.org/github/tcltk/tcl/jobs/722235077]: <pre> ==== proc-4.8 TclCreateProc, procbody obj, no leak on multiple iterations FAILED ==== Contents of test case: set end [getbytes] for {set i 0} {$i < 5} {incr i} { procbodytest::proc tx x px set tmp $end set end [getbytes] } set leakedBytes [expr {$end - $tmp}] ---- Result was: 112 ---- Result should have been (exact matching): 0 ==== proc-4.8 FAILED </pre> This indicates there's still a memory leak. Sorry, again. - login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [deffeb522d] (rid 185775) by jan.nijtmans on 2020-08-29 22:06:04:
- closer changed to: "nobody"
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "None"
- status changed to: "Open"
Ticket change [e8a2b02b14] (rid 185844) by pooryorick on 2020-08-31 17:24:06:
- icomment:
The issue this time is that <code>ProcBodyTestProcObjCmd()</code> synthesizes a proc body that imitates a Tcl Pro proc body and then passes it to <code>Tcl_ProcObjCmd()</code>, which recognizes it as a Tcl Pro compiled proc body and reuses the existing proc rather than creating a new proc. This means that two different commands now share the same Proc structure, which is odd because the <code>Proc</code> structure itself keeps a pointer to the <code>Command</code> structure it is associated with. Which command is it supposed to point to? It seems that in the case of a Tcl Pro compiled procedure, a pointer to the most recent created command is stored, and previous information discarded. In this unusual case, the <code>Proc</code> structure is shared between multiple commands, but that means that <code>Tcl_ProcObjCommand</code> might replace the exising <code>procPtr->cmdPtr</code> with a new one. When it does this it should decrement the reference count of the existing <code>cmdPtr</code>. Previously this wasn't an issue because reference counting of Command structures was limited to its occurrences in ByteCode instruction sequences. Fixed in [c045363cb0b77bf7].
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [275c68d7c2] (rid 185845) by aku on 2020-08-31 17:44:58:
- comment changed to:
The following script produces a segmentation fault in an interpreter built with -DPURIFY and --enable-symbols-debug: <code><verbatim> variable res {} proc p1 args { return success } namespace eval ns1 { namespace export * } interp alias {} [namespace current]::ns1::p2 {} [namespace current]::p1 namespace eval ns2 { namespace import [namespace parent]::ns1::p2 } proc ondelete {oldname newname op} { variable res namespace delete ns1 catch { ns1::p2 } res } trace add command ns2::p2 delete [namespace which ondelete] rename ns2::p2 {} rename p1 {} </verbatim></code> The expected result is an error message about <code>ns1::p2</code> <code><verbatim> invalid command name "ns1::p2" </verbatim></code> The issue is that in <code>tclNamesp.c:DeleteImportedCmd</code>, <code>realCmdPtr</code> points to memory that has already been deallocated. For imported commands reference counting and cleanup is currently incomplete. - login: "aku"
- mimetype: "text/plain"
- comment changed to:
Ticket change [d650b2e6f1] (rid 186333) by jan.nijtmans on 2020-09-05 20:56:30:
- icomment:
> Fixed in [c045363cb0b77bf7]. Sorry, still a memory leak! Therefore I put it back in the original branch.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [b9451e1446] (rid 186340) by jan.nijtmans on 2020-09-05 21:41:03:
- icomment:
Sorry, I was a little to quick reverthing this fix. Looks OK! The actual cause of the memory leak was [c1a376375e], an earlier merge to core-8-branch which was too early. Please, wait until core-8-branch is stable on Travis again, and the travis build for this branch is OK. Then it can be merged again.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [884168443c] (rid 186351) by jan.nijtmans on 2020-09-06 14:50:07:
- icomment:
Well, the Travis build of this branch failed again, turns out it's still not correct. So, I merged in the latest 8.7, so you can try again. Current symptom: <pre> interp.test Test file error: child killed: segmentation violation </pre> See: [https://travis-ci.org/github/tcltk/tcl/builds/724602003]
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [f017e40e3d] (rid 235286) by jan.nijtmans on 2024-11-21 13:39:28:
- closedate changed to: "2460636.06908171"
- closer changed to: "jan.nijtmans"
- icomment:
It looks like the branch "bug-3422267ed6b7992" was abandoned. All of the bug-fix attempts introduced more problems than they solved. Nathan, if you are not working on this any more, better close the ticket. My guess is, that this is duplicate of [02977e0004]. If not, feel free to re-open and start working on it again. But - please - not directly on trunk, breaking all the CI builds.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Duplicate"
- status changed to: "Closed"