Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-06-28
00:37 • Closed ticket [1743941fff]: TclCheckInterpTraces cycles plus 7 other changes artifact: 60ff649987 user: dgp
00:25 • Ticket [1743941fff]: 4 changes artifact: 80ea11f7d0 user: dgp
00:25 • Add attachment 1743941.patch to ticket [1743941fff] artifact: 21e6ebe468 user: dgp
2007-06-27
23:51 • Ticket [1743941fff] TclCheckInterpTraces cycles status still Open with 4 oth... artifact: fcb1bfbcec user: dgp
23:40 • Ticket [1743941fff]: 4 changes artifact: 51cb440662 user: dgp
10:57 • Ticket [1743941fff]: 4 changes artifact: 35f4e698fc user: dgp
08:21 • Ticket [1743941fff]: 4 changes artifact: c1b5969137 user: eugene_cdn
08:21 • Add attachment trace.c to ticket [1743941fff] artifact: 5962139628 user: eugene_cdn
01:21 • New ticket [1743941fff] TclCheckInterpTraces cycles. artifact: 09b2295d37 user: eugene_cdn

TclCheckInterpTraces cycles

Closed / Fixed1743941fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-06-27 01:21:51
OS: Solaris 9, Linux RH 4U3

On certain order of two Tcl_CreateTrace calls, TclCheckInterpTraces never returns on evaluation of a non-trivial commands. Certain order is first trace is of depth "1", and second one is of depth "5" or more on Solaris and "1" on Linux. It cycles in this loop
   for ( tracePtr = iPtr->tracePtr;
      (traceCode == TCL_OK) && (tracePtr != NULL);
           tracePtr = active.nextTracePtr) {
with the same value of tracePtr.

Expected behavior: should not cycles.

See attached testcase. Need to build it
   gcc -o libtrace.so -g -shared -fPIC trace.c -I...
and then
   > tclsh
   tclsh> load libtrace.so
After a while it hangs. If you switch the order (depth) of traces, it works on Solaris.
It does not matter which file to evaluate. It must be non-trivial.
Good luck!
eugene_cdnplain2007-06-27 08:21:51
File Added - 234686: trace.c
dgpplain2007-06-27 10:57:48
Logged In: YES 
user_id=80530
Originator: NO


Reproduced.  Won't have time to really
dig in and fix this for at least a few days.

Meanwhile is might be interesting to see
how far back this problem goes.  Did Tcl 7
suffer the same issue, or is this a regression
sometime since then?
dgpplain2007-06-27 23:40:40
File Added - 234785: 1743941.patch

Logged In: YES 
user_id=80530
Originator: NO


found some unexpected time...

Problem is in the code that
implements reversing the order
of traces for the "enterstep" call.

When the level is too low for the
trace to fire, a "continue" restarts
the loop before "lastTracePtr" gets set
to the right value for proceeding.

So, an effective fix is pretty simple.
Less clear and more troubling is why a
lot of this code is there in the first
place.  Still looking into that.

Attached is a patch against Tcl 8.4.15.


File Added: 1743941.patch
dgpplain2007-06-27 23:51:22
Logged In: YES 
user_id=80530
Originator: NO


ok, I think I recall now.

This is a symptom of some
really bad implementation choices
made in the creation of the *step
execution traces.  Rather than
an orthogonal implementation, those
got done through some ugly surgery
grafting them into the Tcl_CreateTrace
traces, and apparently damaging those
at the same time.

I guess it's an indicator how infrequently
used the Tcl_CreateTrace call is that we
only get a report on this now.
dgpplain2007-06-28 00:25:40
File Deleted - 234785: 



File Added - 234794: 1743941.patch

Logged In: YES 
user_id=80530
Originator: NO


New patch includes test suite addition.
File Added: 1743941.patch
dgpplain2007-06-28 00:37:22
Logged In: YES 
user_id=80530
Originator: NO


fixes committed on both active branches.
Log in (anonymous is fine) to add a comment.

Attachments: