Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f68ef8849131b15b6e09cafb832b6ce42d85da0112ef7b12fbec95f9d6eb0a65
Ticket: 79474c58800cdf94559a2c01230b4536aa416016
refchan segfault
User & Date: apnadkarni on 2024-04-29 06:10:33
Changes

  1. icomment:
    For the record, this bug is still present in Tcl 9.0b2.
    
    Looking at the core dump, the root cause seems similar to that in [88aef05cd](https://core.tcl-lang.org/tcl/tktview/88aef05cda36aca8233a) - reentrancy into TclInvokeMethod. A cursory inspection of the code shows the refchan read method in the test calling close which nests a call into finalize releasing various resources. As the stack unwinds at the top level TclInvokeMethod, freed memory is accessed resulting in the crash.
    
    Fixing would require either
    
    1. Protection of all data structures to handle reentrant calls
    
    2. Forbid any recursive calls into refchans from the script level refchan as suggested by @aku in the above mentioned ticket as one of the options.
    
    The former feels a daunting task for 9.0, though I'm not sure exactly how much work is required. The latter is likely simpler (though not trivial) but would mean backward incompatibility (implying it's either done for 9.0 or have to wait till 10.0), loss of function, and would require a TIP.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"
  4. severity changed to: "Important"