Skip to content
Tcl Source Code History Of Ticket 8f559999fa000614
Login

History Of Ticket 8f559999fa000614

Artifacts Associated With Ticket 8f559999fa000614

  1. Ticket change [32218aa89f] (rid 154720) by pooryorick on 2017-06-22 17:11:10:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      When an error occurs in a coroutine that has a delete trace set on it, the
      delete trace is invoked before the background error handler is invoked. When a
      coroutine is acting as the main routine in a script it may then carry out the
      remainder of the program, oblivious to the error:
      
      <code><verbatim>
      proc bgerror {error options} {
          puts stderr [dict get $options -errorinfo]
          exit 1
      }
      
      proc p1 {} {
          yield [info coroutine]
          error {never gonna give you up}
      }
      
      coroutine main ::apply [list {} {
          yield [info coroutine]
          coroutine c1 p1
          trace add command c1 delete [info coroutine]
          yieldto c1
          exit 0
      } [namespace current]]
      after idle main
      interp bgerror {} [namespace which bgerror]
      vwait forever
      </verbatim></code>
      
    5. foundin initialized to: "head"
    6. is_private initialized to: "0"
    7. login: "pooryorick"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "e476148cded301ffff84bcdc432536dc0c949e88"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "pooryorick"
    14. subsystem initialized to: "20. [interp]"
    15. title initialized to:
      background error swallowed with command delete trace on a coroutine
      
    16. type initialized to: "Bug"
  2. Ticket change [753c88bd0f] (rid 154721) by sebres on 2017-06-22 20:00:20:

    1. icomment:
      Please note that bgerror is an idle-event (with newest generation-value).
      It comparable with (after idle bgerror ...).
      In this case, it will be definitelly executed in the next event-cycle.
      But the trace will be executed still inside the same cycle (within processing of the last event).
      
      To do it in other order:
      - rather don't use bgerror handling.
      - or rewrite your trace also using "after idle".
      
      So works as expected, thus I'll recommend to close the ticket.
      
    2. login: "sebres"
    3. mimetype: "text/plain"
  3. Ticket change [fa019d6ce4] (rid 154743) by sebres on 2017-06-23 08:12:13:

    1. closedate changed to: "2457927.84182281"
    2. closer changed to: "sebres"
    3. icomment:
      I realized that your tracing initialization is wrong here - command executed from trace expects specified arguments.
      
      If you rewrite your code like:
      <code><verbatim>
      proc bgerror {error options} {
          puts stderr [dict get $options -errorinfo]
          puts stderr *************exit-1
          exit 1
      }
      
      proc p1 {} {
          yield [info coroutine]
          puts *************produce-error
          error {never gonna give you up}
      }
      
      proc trace-c1 {args} {
          puts *************in-trace--$args
      }
      
      coroutine main ::apply [list {} {
          yield [info coroutine]
          coroutine c1 p1
          # wrong trace:
          # trace add command c1 delete [info coroutine]
          trace add command c1 delete [list trace-c1 [info coroutine]]
          yieldto c1
          puts stderr *************exit-0
          exit 0
      } [namespace current]]
      
      after idle main
      interp bgerror {} [namespace which bgerror]
      vwait forever
      </verbatim></code>
      
      You'll then see:
      <code><verbatim>
      *************produce-error
      *************in-trace--::main ::c1 {} delete
      never gonna give you up
          while executing
      "error {never gonna give you up}"
          (procedure "p1" line 4)
          invoked from within
      "p1"
          invoked from within
      "c1"
          invoked from within
      "main"
          ("after" script)
      *************exit-1
      </verbatim></code>
      
      Thus I close this as invalid. Please reopen if I'm wrong.
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"