Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-11-11
09:45 • Closed ticket [0e3f777ed5]: Segfault upon sequence of execution traces plus ... artifact: 78a6c33222 user: oehhar
09:44
[0e3f777ed5] Segault upon sequence of execution traces check-in: a583dec2fd user: oehhar tags: core-8-6-branch
09:31
[0e3f777ed5] Segault upon sequence of execution traces check-in: ff4839e9a3 user: oehhar tags: core-9-0-branch
09:30
[0e3f777ed5] Segault upon sequence of execution traces check-in: 245d2b1c48 user: oehhar tags: trunk, main
2026-11-10
16:54 • Ticket [0e3f777ed5] Segfault upon sequence of execution traces status still ... artifact: 29d3627d7c user: oehhar
16:53
[0e3f777e] merge main closed check-in: 48d092ceb0 user: oehhar tags: interp-trace-delete-self
2026-10-14
18:11 • Ticket [0e3f777ed5] Segfault upon sequence of execution traces status still ... artifact: 48cd208ac1 user: serhiy.storchaka
18:10
Fix [0e3f777ed5]: crash when an enterstep trace removed itself while another enterstep trace was set... check-in: 711f947fb2 user: serhiy.storchaka tags: interp-trace-delete-self
2026-07-25
15:25 • Ticket [0e3f777ed5] Segfault upon sequence of execution traces status still ... artifact: 6417b7c113 user: erikleunissen
15:23 • Add attachment stack_trace.txt to ticket [0e3f777ed5] artifact: c893585e68 user: erikleunissen
15:23 • Add attachment exercise.tcl to ticket [0e3f777ed5] artifact: 26bf69b260 user: erikleunissen
15:22 • New ticket [0e3f777ed5] Segfault upon sequence of execution traces. artifact: 81742a99ef user: erikleunissen

Segfault upon sequence of execution traces

Closed / Fixed0e3f777ed566b80ba44886212cfd9882819ee06cCreated 130 days agoUpdated 22 days ago
Descriptionplain2026-07-25 15:22:03
Attached reproducible script "exercise.tcl" and full stack trace in
"stack_trace.txt".

To reproduce do:

> cat exercise.tcl
proc p {} {
    # This proc needs to hold at least one (arbitrary) command
    # for enterstep traces to work.
    puts "p invoked"
}
proc handleTrace1 {args} {
    trace remove execution p enterstep handleTrace1
}
proc handleTrace0 {args} {
    trace add execution p enterstep handleTrace1
}
trace add execution p leave handleTrace0
trace add execution p leave handleTrace0
p
p

> tclsh9.1 exercise.tcl
p invoked
Segmentation fault (core dumped)
Referenced by4
  • a583dec2fd[0e3f777ed5] Segault upon sequence of execution traces check-in2026-11-11 09:44:34
  • ff4839e9a3[0e3f777ed5] Segault upon sequence of execution traces check-in2026-11-11 09:31:30
  • 245d2b1c48[0e3f777ed5] Segault upon sequence of execution traces check-in2026-11-11 09:30:12
  • 711f947fb2Fix [0e3f777ed5]: crash when an enterstep trace removed itself while another enterstep trace was set. The reverse scan of interpreter traces in TclCheckInterpTraces() searched for the predecessor of the deleted trace; now the previous trace is found before the trace is executed and is kept up to date by Tcl_DeleteTrace(). Test trace-34.7. check-in2026-10-14 18:10:17
erikleunissen Ticket [0e3f777ed5]: 3 changes [History diff]2026-07-25 15:25:16
serhiy.storchakawiki2026-10-14 18:11:23

Reproduced with 8.6.18, 9.0.5 and 9.1. When an enterstep trace removes itself while another enterstep trace is set, TclCheckInterpTraces() continues the reverse scan of the interpreter traces from the deleted trace and runs off the end of the list.

Proposed fix in branch interp-trace-delete-self. Test trace-34.7.

oehharwiki2026-11-10 16:54:05

Fix and test are effective. Will merge tomorrow if CI is clean.

Thanks Serhiy, Harald

oehharwiki2026-11-11 09:45:12

Merged to:

Thanks for all. Bug closed.

Harald

Log in (anonymous is fine) to add a comment.

Attachments: