Tcl Source Code

View Ticket
Login
Ticket UUID: e55a589d2bd744cfc176b0bce12696b11c6ca1cb
Title: async send + busy thread + TCL_FINALIZE_ON_EXIT=1 == segmentation fault
Type: Bug Created on: 2025-05-01 10:58:26
Submitter: pooryorick Assigned to: apnadkarni
Subsystem: 80. Thread Package Severity: Minor
Priority: 5 Medium Last modified: 2026-05-23 15:18:18
Status: Closed Closed by: apnadkarni
Resolution: Fixed Closed on: 2026-05-23 15:18:18
Version:
Description:

When evaluated under a recent build of trunk, with the environment variable TCL_FINALIZE_ON_EXIT=1, the following script produces a segmentation fault:

package require Thread
set tid [thread::create]
thread::send -async $tid {while 1 {}}

User Comments:
apnadkarni added on 2026-05-21 15:59:17:
Still present in core-9-0-branch as of today. Verified on Windows and Linux. Examining further ...

apnadkarni added on 2026-05-22 08:17:43:
Proposed fix in [bug-e55a589d2b](https://core.tcl-lang.org/tcl/timeline?r=bug-e55a589d2b). Not sure it is a complete fix, and may leak memory but I don't think a complete fix between non-cooperating threads is possible in Tcl. In any case, since this is at exit time so should suffice as a fix to at least not crash.

apnadkarni added on 2026-05-23 15:18:18:
Fixed in [fc30388d62]. Not backported to 9.0 as a corner case and not worth risking without a full beta cycle.