Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5cd2100413ba211178bfa48936885594e04eebb0
Ticket: 219324ffffffffffffffffffffffffffffffffff
(tcltest) ThreadErrorProc not always called
User & Date: nobody on 2000-10-26 05:10:45
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 3957 Bug
    Version: 8.2.3
    SubmitDate: '1999-12-29'
    LastModified: '2000-10-25'
    Severity: MED
    Status: UnAssn
    Submitter: techsupp
    OS: SunOS
    OSVersion: 5.6
    Machine: Sun Ultra
    FixedDate: '2000-10-25'
    ClosedDate: '2000-10-25'
    
    
    Name:
    
    Peter Silsbee
    
    
    Extensions:
    
    With tcltest, none. Separately, Expect, Tk, tix.
    
    
    CustomShell:
    
    N/A
    
    
    Comments:
    
    Patch is tentative. I'm totally unfamiliar with Tcl source, and have basically no idea what side effects it might cause!
    
    
    ReproducibleScript:
    
    Command line: tcltest script.tcl
    
    
    script.tcl:
    
    
    set errorthread [testthread create]
    
    
    set cmd "proc errorHandler \{id ei\} \{\
    
    puts \"This is my error procedure.\";\
    
    puts \"The thread is \$id\";\
    
    puts \"The errorInfo is <\$ei>\";\
    
    }"
    
    
    testthread send $errorthread $cmd
    
    testthread send $errorthread "testthread errorproc errorHandler"
    
    
    puts "About to commit an error in non-waiting thread"
    
    testthread create "set nonexistent"
    
    
    set thread2 [testthread create]
    
    
    puts "About to commit an error in the thread that is waiting"
    
    testthread send $thread2 "set nonexistent"
    
    
    after 2000
    
    
    puts "I survived to the end of the script"
    
    puts "The remaining threads are [testthread names]"
    
    
    ObservedBehavior:
    
    The procedure "errorHandler" is only called when an error occurs during "testthread create" script evaluation. When an error occurs during "testthread send" evaluation, ThreadErrorProc is never called.
    
    
    DesiredBehavior:
    
    ThreadErrorProc, hence errorHandler if registered, should be called on any thread error?
    
    
    Patch:
    
    *** generic/tclThreadTest.c.oldSat Oct 30 05:06:01 1999
    
    --- generic/tclThreadTest.c.newWed Dec 29 10:27:35 1999
    
    ***************
    
    *** 817,822 ****
    
    --- 817,830 ----
    
      if (code != TCL_OK) {
    
          errorCode = Tcl_GetVar(interp, "errorCode", TCL_GLOBAL_ONLY);
    
          errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
    
    +     ThreadErrorProc(interp);
    
    +     if (errorProcString != NULL) {
    
    +       /*
    
    +        * assume registered error handler can take care of things
    
    +        */
    
    +       code = TCL_OK;
    
    +       errorCode = errorInfo = NULL;
    
    +     }
    
      } else {
    
          errorCode = errorInfo = NULL;
    
      }
    
    
    PatchFiles:
    
    tclThreadTest.c
    
    
    
    
    
    
  4. foundin changed to: "final: 8.2.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "49. Threading"
  10. title changed to: "(tcltest) ThreadErrorProc not always called"
  11. type changed to: "Bug"