#5138 (tailcall|yieldto) failed to find the proper namespace Abort

open
8
2013-03-19
2012-12-05
Colin McCormack
No

Under some circumstances a coroutine can be invoked via ::yieldto while the namespace in which it resides is dying (nsPtr->flags&NS_DYING)

This may occur, and is occuring, for example, when a TclOO object is being destroyed, and a coroutine within it is invoked by an event.

The call to TclGetNamespaceFromObj() at tclBasic.c:8532 will indicate an error, because the current frame's namespace is not considered to match itself in the case that it is dying.

I am unsure what the purpose of the test is, or under what circumstances the two namespaces might differ, but this abort occurs as a result of script evaluation, and hence should be considered a bug.

Discussion

    • labels: --> 60. NRE and coroutines
     
  • miguel sofer
    miguel sofer
    2012-12-05

    • priority: 5 --> 8
     
  • miguel sofer
    miguel sofer
    2012-12-05

    1. no script to repro?
    2. any suggestion as to what should happen in that case? Would an error be in order?

     
  • miguel sofer
    miguel sofer
    2012-12-05

    Note: the problem is likely to appear also with [tailcall].

     
  • miguel sofer
    miguel sofer
    2012-12-06

    The problem is indeed with [tailcall] whose guts are reused by [yieldto]. The current namespace was being cached in an nsNameType Tcl_Obj in order to insure its survival, and as a failure to resolve "could not happen" it was signaled by a panic. As colin is wont to do, he triggered the impossible! Fixed by using a better lifetime management of the namespace.

     
  • miguel sofer
    miguel sofer
    2012-12-06

    • summary: yieldto failed to find the proper namespace Abort --> (tailcall|yieldto) failed to find the proper namespace Abort
     
  • miguel sofer
    miguel sofer
    2013-03-19

    Is this bug still present?

     
  • miguel sofer
    miguel sofer
    2013-03-19

    • assigned_to: msofer --> coldstore
     
  • This is why it's great to have a test, so we can confirm when the bug is dead…