Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2019-04-17
15:09 • Closed ticket [60559fd4a6]: -singleproc + coroutine-7.6 + info-23.0.1 => fail... artifact: fd17ecad7d user: dgp
15:08
[60559fd4a6] Test more robust against frame contexts of testing environment. check-in: 1b2cf8fff3 user: dgp tags: core-8-branch
2019-04-11
21:41 • Ticket [60559fd4a6] -singleproc + coroutine-7.6 + info-23.0.1 => fail sta... artifact: f887586604 user: dkf
21:39
Suggested fix for [60559fd4a6]: put selected tests in child interps closed check-in: d321b807d3 user: dkf tags: bug-60559fd4a6
21:39 • Ticket [60559fd4a6] -singleproc + coroutine-7.6 + info-23.0.1 => fail sta... artifact: bb65d8b34e user: dkf
20:58 • Ticket [60559fd4a6]: 3 changes artifact: c38b45213e user: sebres
19:28 • Ticket [60559fd4a6]: 3 changes artifact: a0f3b1054e user: dkf
18:32 • Ticket [60559fd4a6]: 4 changes artifact: 378d594fa2 user: dkf
16:53 • Ticket [60559fd4a6]: 3 changes artifact: 473c12ef52 user: dgp
16:02 • New ticket [60559fd4a6]. artifact: 679c5a86f8 user: dgp

-singleproc + coroutine-7.6 + info-23.0.1 => fail

Closed / Fixed60559fd4a618258cceacc8d8966ea17b2ec7bc15Created 8 years agoUpdated 8 years ago
Descriptionplain2019-04-11 16:02:52
$ make test-tcl TESTFLAGS='-singleproc -file "coroutine.test info.test" -match "coroutine-7.6 info-23.0.1"'
...
==== info-23.0.1 eval'd info frame FAILED
==== Contents of test case:

    eval {info frame}

---- Result was:
13
---- Result should have been (glob matching):
1[12]
==== info-23.0.1 FAILED
Referenced by2
  • 1b2cf8fff3[60559fd4a6] Test more robust against frame contexts of testing environment. check-in2019-04-17 15:08:25
  • d321b807d3Suggested fix for [60559fd4a6]: put selected tests in child interps check-in2019-04-11 21:39:50
dgpplain2019-04-11 16:53:11
Bisecting says then unhappiness starts here:

https://core.tcl-lang.org/tcl/info/0c54ff4afafe9fe2
dkfhtml2019-04-11 18:32:41

Seems to be an inconsistent state somewhere. Here's an illustrative interactive session:

% info frame
1
% eval {
    proc foo args {}
    trace add execution foo enter {catch yield}
    coroutine demo foo
    rename foo {}
}
% info frame
1
% eval {
    info frame
}
2
% eval {
    proc foo args {}
    trace add execution foo enter {catch yield}
    coroutine demo foo
    rename foo {}
    info frame
}
3

dkfhtml2019-04-11 19:28:49

The following test case (provisionally named) shows that this has nothing to do with coroutines. It does have plenty to do with foo having a direct compileProc (special case to allow disabling logging/asserts).

test coroutine-7.6a {Early yield crashes} -setup {
    set result {}
} -body {
    proc foo args {}
    set BaseFrameLevel [info frame]
    eval {
        lappend result [expr {[info frame] - $BaseFrameLevel}]
        trace add execution foo enter list
        lappend result [expr {[info frame] - $BaseFrameLevel}]
    }
} -cleanup {
    rename foo {}
    unset -nocomplain result BaseFrameLevel
} -result {1 1}
This is weird stuff!

sebreswiki2019-04-11 20:58:46

It looks like the epoch-bump (with followed re-compilation) is indirectly responsible for this disaster:

set result {}
proc bar args {}
proc foo args {}
set BaseFrameLevel [info frame]
eval {
  lappend result [expr {[info frame] - $BaseFrameLevel}] [regexp -inline {^\S+} [dict get [info frame -1] cmd]]
  rename bar buz; ## ********** change of compileEpoch.
  lappend result [expr {[info frame] - $BaseFrameLevel}] [regexp -inline {^\S+} [dict get [info frame -1] cmd]]
  puts $result
}

set result {} eval { lappend result [expr {[info frame] - $BaseFrameLevel}] [regexp -inline {^\S+} [dict get [info frame -1] cmd]] rename buz bar; ## ********** change of compileEpoch. lappend result [expr {[info frame] - $BaseFrameLevel}] [regexp -inline {^\S+} [dict get [info frame -1] cmd]] puts $result }

So interpreter tracing is not involved.

dkfhtml2019-04-11 21:39:09

It's totally the epoch bump. That pushes that stack frame's evaluation engine into a state where it uses interpretation instead of compilation until the frame is purged, which is a long time away for the global stack frame in a -singleproc 1 situation (longer than in 8.5; 8.6 compiles more aggressively for good NRE-support reasons), and interpretation sees more frames in info frame than compilation.

This is evil evil evil, and not a bug that we should fix. Except for the tests being too keen on triggering the bump. The tests that cause the problem (that I've seen; there might be more) are coroutine-7.6 and coroutine-7.7.

dkfwiki2019-04-11 21:41:55

See https://core.tcl-lang.org/tcl/timeline?r=bug-60559fd4a6 for what I think the fix should be.

dgp Closed ticket [60559fd4a6]. [History diff]2019-04-17 15:09:51
Log in (anonymous is fine) to add a comment.