Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 879a90f3fd3e929d697c91433d16ec981b601109050df4416068dbbed0c55fb4
Ticket: ec1ee3bc921ff34aaf0391781c2a90eed1fceffa
tcltest crashes when a [testasync] handler is invoked from the event loop (NULL interp)
User & Date: serhiy.storchaka on 2026-10-18 09:39:59
Changes

  1. cmimetype changed to: "text/x-fossil-wiki"
  2. comment changed to:
    The tcltest binary crashes (segmentation fault) when a <nowiki>[testasync]</nowiki> handler is invoked from the event loop:
    
    <verbatim>
    proc cb {result code} {return $code}
    set h [testasync create cb]
    testasync marklater $h
    after 500 {set done 1}
    vwait done
    </verbatim>
    
    <tt>AsyncHandlerProc()</tt> in generic/tclTest.c calls <tt>Tcl_GetStringResult(interp)</tt> before it checks for <tt>interp == NULL</tt>, which is what <tt>Tcl_AsyncInvoke()</tt> passes when async handlers run from the event loop. Only the test command is affected, not the library. Seen with 8.6.18, 9.0.5 and 9.1.0.
    
    Proposed fix in branch [/timeline?r=testasync-null-interp|testasync-null-interp]: without an interpreter the handler just returns the code. Test async-5.1.
    
  3. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
  4. login: "serhiy.storchaka"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. severity changed to: "Minor"
  8. status changed to: "Open"
  9. subsystem changed to: "04. Async Events"
  10. title changed to:
    tcltest crashes when a [testasync] handler is invoked from the event loop (NULL interp)
    
  11. type changed to: "Bug"