Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3d77fdf0f884fab51a865287203dc7b1c6ab3980
Ticket: 2921116fffffffffffffffffffffffffffffffff
Segmentation fault when removing the transformation
User & Date: andreas_kupries on 2010-01-20 02:32:21
Changes

  1. assignee changed to: "dgp"
  2. icomment:
    Now attached is a patch which seems to fix the problem.
    
    It uses Tcl_Preserve/Release/EventuallyFree to keep the structure around while the channel driver functions are running. This is done only where we have callbacks which could destroy it.
    
    The ReflectClose function is an exception, because when it is run we are in the destruction already. Doing another destruction in its callbacks (drain. flush, finalize) will very likely still crash us. But the preserve/release looks to be very complex, so I punted on it in this patch.
    
    Part of the problem, and also why I am still uneasy about the patch in general is the behaviour in a threaded environment. More specifically, when the channel with the transform is moved into different thread, and then we have preserve/release on the same structure from different threads, and the eventuallyfree may run in the wrong thread ?!
    
    I might be fretting over nothing here, because:
    
    (1) such a self-closing transform as shown in the example will not work at all when the channel it is part of is moved to a different thread, as the handler code will lose access to the channel (handle), and this will stop such an attempt in its tracks before it even reaches the reflection internals at all.
    
    (2) Moving a transform which does not modify/close itself seems to work. At least the iortrans.tf set of tests does pass, no failures, nor crashes.
    
    Reassigning to dgp for review of my code and reasoning.
    
    
  3. login: "andreas_kupries"
  4. mimetype: "text/plain"
  5. username: "andreas_kupries"