Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2010-09-28
21:45 • Ticket [3072640fff] trace execution + yield fails ASSERT status still Closed... artifact: 0c09041e6d user: dkf
21:35 • Closed ticket [3072640fff]. artifact: c9276a5fff user: msofer
21:23 • Open ticket [3072640fff]. artifact: 0dd0447d36 user: twylite
21:23 • Ticket [3072640fff]: 4 changes artifact: d416b03159 user: twylite
2010-09-23
01:38 • Pending ticket [3072640fff]. artifact: fbf98ec4ff user: msofer
01:38 • Ticket [3072640fff]: 4 changes artifact: 0ca9aab9e1 user: msofer
00:35 • Ticket [3072640fff]: 5 changes artifact: 1a00122a1b user: msofer
2010-09-22
18:17 • Ticket [3072640fff]: 4 changes artifact: 759e3f549b user: msofer
2010-09-21
20:08 • Ticket [3072640fff]: 1 change artifact: ab4cd03888 user: twylite
13:08 • New ticket [3072640fff]. artifact: dec39fbea5 user: twylite

trace execution + yield fails ASSERT

Closed / Fixed3072640fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2010-09-21 13:08:03
Adding an execution (enterstep) trace to a proc that yields causes an ASSERT to fail, crashing the interp.

Environment: 
- x86 32 bit
- Windows XP SP3 with latest patches
- Tcl 8.6b1.2 (from CVS 2010/08/30), also appears in Tcl 8.6b1.1)

Symptom:
- Assertion failed (MS Visual C++ Runtime Library error popup)
- Source of failure: tclExecute.c:2882 NRE_ASSERT(BP == corPtr->eePtr->bottomPtr);

Code to reproduce:
--
  proc generate {n} {
    for {set i 0} {$i < $n} {incr i} {
      yield $i
    }
  }
  proc t {args} { puts "Trace: $args" }
  trace add execution ::generate enterstep ::t
  coroutine coro generate 5
--

Further information:
- Putting the [yield] into the trace handler ::t rather than the proc being traced results in the error "cannot yield: C stack busy", but doesn't lead to a crash.
twylite Ticket [3072640fff]: 1 change [History diff]2010-09-21 20:08:41
msoferplain2010-09-22 18:17:30
Patch #3072080 fixes this issue (which seems hard to hunt down in the current NRE implementation); resolution pending the decision on adopting that patch.
msoferplain2010-09-23 00:35:49
Issue seemed fixed by today's commit, which fixed a different bug discovered by Patch #3072080. BUT: new test execute-10.3 still bombs (it doesn't with the patch)
msoferplain2010-09-23 01:38:07
Fixed in HEAD.
msofer Pending ticket [3072640fff]. [History diff]2010-09-23 01:38:08
twyliteplain2010-09-28 21:23:30
Confirmed that the code sample I submitted no longer crashes following the NRE commit on 2010-09-26.  I think this issue can be closed.

Regarding the "C stack busy" attempting to [yield] from a trace event - is that its own problem, is it something that can/should be fixed?
twylite Open ticket [3072640fff]. [History diff]2010-09-28 21:23:31
msoferplain2010-09-28 21:35:58
allow_comments - 1

Traces are not nre-enabled, and are unlikely to be in the near future: it is extremely tough to get that right.

This means that you will not be able to yield from a within a trace in 8.6.
dkfplain2010-09-28 21:45:08
s/extremely tough/really scary hard/

Fair chance that we'll never take that task on. It'd be cool, but likely to cause nervous breakdowns. :-)
Log in (anonymous is fine) to add a comment.