Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f9118d31c33b6cc6d4438e9533456d307e32ff58
Ticket: 2059262fffffffffffffffffffffffffffffffff
regression: crash after unloading proprietary library
User & Date: nijtmans on 2008-08-19 08:23:53
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Some libraries, e.g. the Mbx library from the secs project, let Tcl crash when the library is unloaded.
    This is related to tip #239.
    There has been a private discusson about that,
    here are just some copies of the relevant parts:
    
    =================================================
    
    The reason we need the Tcl-level extras is that it introduces at least one key feature - per-library opt-out of being closed/unloaded.  This is very important for some libraries that have atexit handlers and similar weird issues (like Oracle's stuff).
    
    Jeff
    
    ==================================================
    
    Yes, I encountered a proprierary library as well
    which has problems with unloading in Tcl 8.5
    but worked perfectly in Tcl 8.4 ;-(. Shouln't
    libraries report by itself if they support
    unloading or not, in stead of building it in
    in the load command? We could simply check
    if the library has an unloadproc, and only
    unload it if it has one. Something like the
    patch below. Then any library which wants
    the unload feature only has to define the 
    symbol, that's it.
    
    This patch seems to fix my problem (but
    it is barely tested, so your comments are
    welcome....)
    
    Regards,
              Jan Nijtmans
    ==================================================
    The problem with that is that it then adds the burden of creating the unload proc for all the well-behaved libraries.  It might be worth considering special values like Tcl_EventuallyFree does, whereby TCL_UNLOAD_OK could be specific as the unloadProc (meaning it should unload with the usual native stuff).
    
    Any way you cut it, that just adds some special casing for something I want to be generalized.  If it means we need Tcl_Load* APIs, I think that's acceptable.
    
    Jeff
    ==================================================
    Thinking more about it, I think we are dealing
    with two different things here:
    1) A regression in Tcl 8.5 compared to 8.4. The
       mbx package I wrote for the secs project uses
       a proprietary library libCw.a. This library
       crashes when Tcl 8.5 exits, but with Tcl 8.4
       it works perfectly.
    2) Extend the API in both Tcl and C to allow
       more control over the unloading of libraries.
    
    Both should be considered separately. I propose
    to submit a bug ticket for 1), which can be
    solved without a TIP, and backported to Tcl
    8.4. This private discussion can then be
    continued there. It is indeed a burden to
    create an unload proc for well-behaved
    libraries, but that's small and easy and
    it restores the Tcl 8.4 behaviour for
    ill-behaved libraries. We only have to
    do that for a small number of libraries
    (the ones in the core), and only
    the extension writers who want to support
    unloading need to do it as well.
    I volunteer to do that, as soon as we
    reach agreement.
    
    A separate issue is 2), which needs a TIP
    and cannot be backported to Tcl 8.5. Personally,
    for the C api I would just use dlopen, so we
    don't have to do anything for Linux and friends.
    But I can live very well with the proposed
    Tcl_Load* API as well.
    
    Regards,
            Jan Nijtmans
    
  4. foundin changed to: "obsolete: 8.5.4"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "nijtmans"
  10. subsystem changed to: "None"
  11. title changed to:
    regression: crash after unloading proprietary library
    
  12. type changed to: "Bug"