Tcl Source Code

View Ticket
Login
Ticket UUID: 811483
Title: delete trace calls traced command ->segfault
Type: Bug Version: obsolete: 8.4.4
Submitter: dgp Created on: 2003-09-24 01:59:12
Subsystem: 46. Traces Assigned To: dgp
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2003-10-04 03:46:45
Resolution: Fixed Closed By: dgp
    Closed on: 2003-10-03 20:46:45
Description:
test trace-32.1 {nystery memory corruption} knownBug {
    proc foo {} {}
    trace add command foo delete foo
    trace add execution foo enter foo
    set result [trace info command foo]
    rename foo {}
    set result
} [list [list delete foo]]


This test causes a segfault.

apparently related to the fact that
the deletion trace tries to call the
traced command, but still needs
further tracking down.  It's nasty
memory corruption somewhere.
User Comments: dgp added on 2003-10-04 03:46:45:
Logged In: YES 
user_id=80530

fixed for 8.4.5+

dgp added on 2003-10-03 20:29:50:
Logged In: YES 
user_id=80530

Thanks.  I have good confidence there
will be no trouble untracing the trace
at that point, because the ActiveTrace
trickery is used throughout the trace
system just to enable the untracing at
any time.

vincentdarley added on 2003-10-03 16:18:23:
Logged In: YES 
user_id=32170

As far as I can tell, this looks ok, but I haven't fully
investigated the implications of calling Tcl_UntraceCommand
at that point.

p.s. thanks for looking into all these 'trace' issues, and
sorry I haven't been more forthcoming with help/advice.

dgp added on 2003-10-03 01:54:54:

File Added - 63233: 811483-HEAD.patch

Logged In: YES 
user_id=80530

Here's the corresponding patch
for the HEAD.

dgp added on 2003-10-03 00:51:30:

File Added - 63227: 811483.patch

dgp added on 2003-10-03 00:51:26:
Logged In: YES 
user_id=80530


This patch stops the accessing
of freed memory by test
trace-32.1, and also corrects
some coding errors found
along the way.

Assigning to TIP 62 implementor
for a chance to comment.

dgp added on 2003-09-29 21:16:16:
Logged In: YES 
user_id=80530


at least some of the problem
appear due to an error in
refcounting of the
TraceCommandInfo struct
in TraceCommandProc().
There the refCount is
decremented without actually
removing the reference, and
the inconsistency leads to trouble.

There are probably good lessons
on how to get this right in the
variable tracing code.

Attachments: