Artifacts Associated With Ticket 24949cbd7c
Ticket change [71126824be] (rid 195313) by sebres on 2021-08-10 12:45:25:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
I was searching for the heisenbug, occurring extremely rare at initialization phase of a (multithreaded) tcl-application. The callstack shows: <pre style="padding-left:10pt"><code> Thread 9 received signal SIGSEGV, Segmentation fault. [Switching to Thread 18320.0x1c0c] 0x50589c0b in tcl85!Tcl_GetStringFromObj () from ./tcl85.dll (gdb) bt #0 0x50589c0b in tcl85!Tcl_GetStringFromObj () from ./tcl85.dll #1 0x505d9e87 in tcl85!TclpMatchInDirectory () from ./tcl85.dll #2 0x50575db6 in tcl85!Tcl_FSMatchInDirectory () from ./tcl85.dll ... #35 0x505962fc in tcl85!Tcl_PkgRequireEx () from ./tcl85.dll </code></pre> After analyzing the code in TclpMatchInDirectory and tclPathObj, the error is obvious - it is occurred by [./file?ci=1b84e484da461b64&name=win%2FtclWinFile.c&ln=981-1007|win/tclWinFile.c&ln=981-1007] in ln. 1007 when between ln. 981 and ln. 990 some other thread changing the FS epoch, so the object <code>pathPtr</code> invalidates the internal representation and <code>fileNamePtr</code> disappears.<br/> (Indirectly, this going to the [./file?ci=1b84e484da461b64&name=generic/tclPathObj.c&ln=1175|Tcl_FSConvertToPathType] which can invalidate the object if check with TclFSEpochOk shows modification of FS epoch, which is system wide so can occur in other thread). One could surely increment the reference of <code>fileNamePtr</code> in TclpMatchInDirectory temporarily, but there are too many code pieces (inclusive tclPathObj.c itself) with the assumption that if path-object can't shimmer, its internal representation remains the same, what is obviously not the case by this approach considering the system wide epoch. If this issue cannot be solved using different common approach, the whole code using several path-API functions (in generic/ but also in win/ and unix/) must be reviewed, e. g. extended with incr+decr ref-count for many objects comming from internal representation of path-type objects using Tcl-API or direct assignment.
- foundin initialized to: ">= 8.5"
- is_private initialized to: "0"
- login: "sebres"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "sebres"
- subsystem initialized to: "36. Pathname Management"
- title initialized to:
Many functions of tclPathObj are not thread safe (can segfault by changing of FS epoch)
- type initialized to: "Bug"
Ticket change [082ed19b64] (rid 195314) by sebres on 2021-08-10 12:45:44:
- login: "sebres"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
Ticket change [b6366eefd6] (rid 258002) by serhiy.storchaka on 2026-10-14 13:44:51:
- icomment:
The crash in TclpMatchInDirectory described here was fixed for [61c01e0edb] by the reference counting added in [0d48bb289c] and [4aae9497e4], in 8.6.17 and 9.0.3. Is there another concrete case left, or can this be closed?
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Pending"
- icomment: