Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: dc8ef824cfb77d2fbc0c6f072b1c1ec634ed6b53
Ticket: 2869384fffffffffffffffffffffffffffffffff
Tcl_AsyncMark does not work with --enable-threads
User & Date: eugene_cdn on 2009-09-29 01:33:23
Changes

  1. assignee changed to: "mistachkin"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OS: sparc Solaris 10
    Tcl_AsynMark cannot be called in a signal handler because it locks the same mutex (notifierMutex) as Tcl_WaitForEvent. If a signal is handled in main thread when it serves Tcl events, then deadlock is very probable. Attached example will produce a stack like this
         -----------------  lwp# 1 / thread# 1  --------------------
         feb40408 lwp_park (0, 0, 0)
         ff0385fc Tcl_MutexLock (ff08247c, 0, 0, 1000, 0, 0) + b4
         ff039624 Tcl_AlertNotifier (2bda8, 0, 0, 1000, 0, 0) + 34
         fefd83a8 Tcl_ThreadAlert (1, 0, 0, 0, 0, 0) + a8
         feedf7e0 Tcl_AsyncMark (1a80d8, 0, 0, 0, 0, 0) + 60
         fee306a8 GotAlarm (e, 0, ffbfeb10, 1, 21c30, 21c2c) + 30
         feb40494 __sighndlr (e, 0, ffbfeb10, fee30678, 0, 1) + c
         feb3558c call_user_handler (e, 0, 4, 0, ff0c2000, ffbfeb10) + 3b8
         feb4187c _write   (4, ff05ce88, 1, 0, 0, 2c0b5) + c
         ff03a2f0 Tcl_WaitForEvent (224e8, fffffffd, ff1966e4, ff3ee0f8, ff3f06e0, 0) + 3c0
         fefd7f74 Tcl_DoOneEvent (0, 6e7f8, 0, 0, 1, 0) + 1ec
         ff17c738 Tk_MainLoop (2c1a8, 31188, 0, 1, 1, 5400) + 48
         ff1966e4 Tk_MainEx (2, ffbff2ac, 10e90, 2c1a8, 4, 4) + b1c
         00010e60 main     (2, ffbff2ac, ffbff2b8, 21000, ff0c0100, ff0c0140) + 50
         000109e0 _start   (0, 0, 0, 0, 0, 0) + 108
         -----------------  lwp# 2 / thread# 2  --------------------
         feb40408 lwp_park (0, 0, 0)
         ff0385fc Tcl_MutexLock (ff08247c, fea7bf1c, fea7be9c, fea7be1c, 0, fea7bea5) + b4
         ff03a8e4 NotifierThreadProc (0, fea7c000, 0, 0, ff03a4a8, 1) + 43c
         feb40368 _lwp_start (0, 0, 0, 0, 0, 0)
    in a few seconds. To reproduce the problem, use regular wish built with --enable-threads and use attached script as input:
        wish run.tcl
    It will hang shortly. To speed up hanging, one can decrease timeouts. Tk must serve some events to make the application hanging faster, so the script changes text widget in loop. Build script is attached (need to modify paths).
    
  4. foundin changed to: "obsolete: 8.5.5"
  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: "eugene_cdn"
  10. subsystem changed to: "04. Async Events"
  11. title changed to: "Tcl_AsynMark does not work with --enable-threads"
  12. type changed to: "Bug"