Artifacts Associated With Ticket 1988779
Ticket change [32735f3e23] (rid 93612) by cnassau on 2008-06-09 10:30:30:
- assignee initialized to: "vasiljevic"
- cmimetype initialized to: "text/plain"
- comment initialized to:
We're occasionally seeing panics with Thread.2.6.5 and Tcl.8.5.2: Tcl_SetStringObj called with shared object A typical stack trace is IOT/Abort trap in pthread_kill at 0xd005aaf4 ($t8) 0xd005aaf4 (pthread_kill+0xa8) 80410014 lwz r2,0x14(r1) (dbx) where pthread_kill(??, ??) at 0xd005aaf4 _p_raise(??) at 0xd005a100 raise.raise(??) at 0xd01e367c abort.abort() at 0xd01f2280 Tcl_PanicVA() at 0xd4f14c78 Tcl_Panic() at 0xd4f14cf4 Tcl_SetStringObj() at 0xd4f3293c ThreadSend() at 0xd5ded484 ThreadSendObjCmd() at 0xd5dea548 TclEvalObjvInternal() at 0xd4f4b1c8 (...) The implementation of ThreadSend in file thread2.6.5/generic/threadCmd.c contains the lines code = resultPtr->code; Tcl_SetStringObj(Tcl_GetObjResult(interp), resultPtr->result, -1); which seems suspicious. I see no compelling reason why Tcl_GetObjResult(interp) should be unshared at that point, so a plain Tcl_SetResult(interp, resultPtr->result, TCL_VOLATILE); should be used instead. Note: there's also a similar line in SvObjObjCmd in file thread2.6.5/generic/threadSvCmd.c - foundin initialized to: "obsolete: 8.5.2"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "cnassau"
- subsystem initialized to: "80. Thread Package"
- title initialized to: "Tcl_SetStringObj called with shared object"
- type initialized to: "Bug"
Ticket change [754d6065b1] (rid 105366) by dkf on 2008-06-10 20:30:21:
- icomment:
Logged In: YES user_id=79902 Originator: NO I prefer this: Tcl_SetObjResult(interp, Tcl_NewStringObj(resultPtr->result, -1)); though I'd even more strongly prefer it if the resultPtr pointed to a structure that knew the length of the string being transferred.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [10dab16309] (rid 95032) by vasiljevic on 2008-06-12 11:19:11:
- icomment:
Logged In: YES user_id=95086 Originator: NO I personally do not care as long as it works. I believe this pattern is left in the code by mistake as I tried to change that behaviour long time ago. And, I haven't sucked it out of my finger. This stood (perhaps still stays) in the Tcl docs as a preffered way how to handle result object. Do not ask me where and when I read that. I can't remember. I just now I read that and wrote it accodring to the recomendation, just to find out that this brought lots of problems down the road. So I wholesale changed all my code to scrap those out. Obviously in the threading extension there are places where this is still used. I will go thru and remove all those parts. Instead of Tcl_SetStringObj(Tcl_GetObjResult(interp), resultPtr->result, -1); it will read Tcl_SetObjResult(interp, Tcl_NewStringObj(resultPtr->result, -1)); The original "idea" was that the former should save us the need to create new Tcl_Obj as Tcl result should already point to a good one. And that one should not be shared. This is sometimes not true for whatever reasons, I do not know. Thanks for the report. Zoran
- login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"
- icomment:
Ticket change [71f845828b] (rid 100784) by hobbs on 2008-11-04 06:47:47:
- icomment:
Fixed to use safest Tcl_SetObjResult(interp, Tcl_NewStringObj(...))
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Ticket change [bb36c6eca6] (rid 129446) by hobbs on 2008-11-04 06:47:51:
- closedate changed to: "2008-11-03T23:47:51"
- closer changed to: "hobbs"
- resolution changed to: "Fixed"
- status changed to: "Closed"