Skip to content
Tcl Source Code History Of Ticket 39bb9b3ebb5ea83c
Login

History Of Ticket 39bb9b3ebb5ea83c

Artifacts Associated With Ticket 39bb9b3ebb5ea83c

  1. Ticket change [db9d293045] (rid 143874) by aspect on 2015-11-11 04:29:36:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      When a coroutine is deleted by [rename] or through deletion of its namespace,
      finally handlers are not invoked:
      
      
      % coroutine foo try yield finally {puts ok}
      % rename foo {}
      
      % namespace eval foo { coroutine foo try yield finally {puts ok} }
      % namespace delete foo
      
      Delete traces do fire, providing a sort of workaround:
      
      % coroutine foo apply {{{t 0}} {
          trace add variable t unset {puts ok; list}
          yield
      }}
      % rename foo {}
      ok
      
      Arguably this might not be a bug, but it renders [try .. finally] unreliable
      for resource deletion in the presence of coroutines.
      
      
      Miguel's previous comments from the chat:
      
      2015-08-09:
      
      <aspect> % coroutine c try yield finally {puts ok}; rename c {}   ;# no output
      <aspect> that makes deleting coroutines .. problematic
      <aspect> delete traces fire though:
      <aspect> % coroutine c apply {{{t 0}} {trace add variable t unset {puts ok;
               list}; yield}}; rename c {}   ;# emits "ok"
      
      <miguel> what is problemtic about deleting coroutines?
      <miguel> they self-delete when they return; you can delete them as normal
               commands otherwise - even from within
      <miguel> ohhh ... the finally never executed, right ... will look into it
      <miguel> (possibly a problem also for [interp cancel], as they share the
               mechanism iirc)
      <miguel> it is a fundamental problem - the classic invincible-force vs
               unmovable-object: "cancel everything no matter what" vs "before
               canceling you HAVE to do this one thing (which may require infinite
               resources)"
      <miguel> (at least in the [interp cancel] version)
      <miguel> % try {interp cancel -unwind} finally {puts ok}
      <miguel> eval unwound
       * miguel finds this not trivial at all
      <miguel> the problem is that the finally clause WILL get executed RIGHT AFTER 
               the try clause finishes - which happens to be NEVER in aspect's setup
      
      
      2015-11-11:
      
      <miguel> I have a vague recollection that we talked about it, and that I thought
               'not a bug' ...
      <miguel> ... finally meaning 'before this command returns', and your ops making
               sure that the command in question never returned ...
      <miguel> ... so that 'never' satisfies 'before the command returns'
      
    5. foundin initialized to: "8.6.4"
    6. is_private initialized to: "0"
    7. login: "aspect"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "a0e4455685fad6d7c7fc63ae05f16454df49fdf3"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "aspect"
    14. subsystem initialized to: "60. NRE and coroutines"
    15. title initialized to:
      deleting a coroutine bypasses try..finally handlers
      
    16. type initialized to: "Bug"