Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d7e202e61ed22b5571a2636249d768098c379817d09409e7b422a07b7c3e6dcb
Ticket: 87271f7cd6ab29a076b36e31041a8c940c20d943
TclOO + coroutine + event loop = coredump
User & Date: twylite on 2022-08-12 21:18:48
Changes

  1. icomment:
    I've just found a bug that I can reproduce on 8.6.2 (Win32) with the code below.   It involves `yield`ing a coroutine in a method, then doing an `info frame` that introspects the method. I came across this ticket while looking for known issues, and I think there's a chance it is another symptom of the same problem.
    
    ```tcl
    oo::class create LogDies {
      method process {args} {
        puts "[info coroutine] Starting"
        set randMs [expr { 1050 + int([tcl::mathfunc::rand] * 1000) }]
        after $randMs [info coroutine] ; yield
        puts "[info coroutine] Back from yield $randMs ms"
        info frame 0 
        #or: apply {{} { info frame -1 }}
      }
    }
    
    set obj [LogDies new]
    time { coroutine c[incr ctr] $obj process a1 a2 } 100
    ```
    
    - I can confirm that the code to reproduce this ticket causes an Access Violation (0xc0000005) fault on 8.6.2 (Win32).
    - My code above reproduces a bug probabilistically, not deterministically. I suspect there is a more concise deterministic reproduction (working on it, and on testing with a more recent build).
    - Wildly guessing based on dfk's comment (2022-06-28 12:04), doesn't a coroutine delete its Command while it is running?
    - Re how a method stack frame is involved: in my case it is the attempt to introspect the method stack frame that causes the process to die. I don't get a fault if I use `apply {{} { apply {{} { info frame -1}} }}` or `info frame -1` within the method.
    
  2. login: "twylite"
  3. mimetype: "text/x-markdown"
  4. username: "twylite"