Skip to content
Tcl Source Code History Of Ticket 718045
Login

History Of Ticket 718045

Artifacts Associated With Ticket 718045

  1. Ticket change [1d7dfc3d3e] (rid 90824) by kenj on 2003-04-09 07:34:13:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      I'm attaching a script that crashes each time I run it on 
      my system. It's an echo server translated from a single-
      threaded to a multi-threaded implementation.
      
      As written, clients can connect to the server and 
      successfully receive echoes of messages they send. 
      (I've tested it using simple telnet connections.) However, 
      when any client disconnects -- either by closing the 
      client or by issuing the "quit" message -- the server 
      crashes with the following message:
      
      FlushChannel: damaged channel list
      
      abnormal program termination
      
      There was another problem I noticed with this script, 
      that perhaps should be filed as a separate bug. You'll 
      note a few lines near the bottom commented out, which 
      tried to send a "welcome" message after the client 
      connected. The code would send the message 
      successfully, but then the readable fileevent seemed to 
      never fire within the worker thread.
      
      Unfortunately, as I'm running this on Windows 2000, I'm 
      not sure what additional debugging information I can 
      provide. As far as the environment, the operating system 
      is Microsoft Windows 2000, 5.00.2195, Service Pack 3. 
      I'm running the script from a Command Prompt window 
      by executing "tclsh echoserv3.tcl".
      
      The tclsh is version 8.4.2, compiled on my system 
      directly from the source, with threading enabled. The 
      Threads version is 2.5.1, also compiled on my machine.
      
      I compiled both using the Mingw tools. The beginning of 
      the README.txt file says: "This is msys_mingw release 
      #2, it bundles Msys 1.0.8 and Mingw 1.1." gcc --version 
      returns 2.95.3-6.
      
    4. foundin initialized to: "obsolete: 8.4.2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "kenj"
    9. subsystem initialized to: "49. Threading"
    10. title initialized to: "Closing transferred channel crashes app"
    11. type initialized to: "Bug"
  2. Ticket change [db8569aa77] (rid 107977) by kenj on 2003-04-09 14:34:14:

    1. icomment:
      
      
      File Added - 47207: echoserv3.tcl
      
      
      
    2. login: "kenj"
    3. mimetype: "text/plain"
    4. username: "kenj"
  3. Add attachment "echoserv3.tcl" [983a292429] (rid 110572) by kenj on 2003-04-09 14:34:14.

  4. Ticket change [7b1d493747] (rid 90465) by andreas_kupries on 2003-04-09 23:40:56:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Does this happen on a unix system too ?
      Does it happen when compiled with MS VC++ too ?
      (That is the environment I have).
      
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  5. Ticket change [242b155fde] (rid 131067) by andreas_kupries on 2003-04-15 02:12:09:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      I notice in the ChangeLog a change by Mo DeJong on Jan 25, 
      2003 in that area. Here is the entry:
      
      +2003-01-25  Mo DeJong  <[email protected]>
      +
      +* generic/tclIO.c (Tcl_CutChannel, 
      Tcl_SpliceChannel):
      +Invoke TclpCutFileChannel and 
      TclpSpliceFileChannel.
      +* generic/tclInt.h: Declare TclpCutFileChannel
      +and TclpSpliceFileChannel.
      +* unix/tclUnixChan.c (FileCloseProc, 
      TclpOpenFileChannel,
      +Tcl_MakeFileChannel, TclpCutFileChannel,
      +TclpSpliceFileChannel): Implement thread load 
      data
      +cut and splice for file channels. This avoids
      +an invalid memory ref when compiled with -
      DDEPRECATED.
      +* win/tclWinChan.c (FileCloseProc, 
      TclpCutFileChannel,
      +TclpSpliceFileChannel): Implement thread load 
      data
      +cut and splice for file channels. This avoids
      +an invalid memory ref that was showing up in the
      +thread extension.
      
      Can you test if the problem you encounter happens with a Tcl 
      from before that change too ?
      
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. priority changed to: "8"
    5. username: "andreas_kupries"
  6. Ticket change [f749b8f397] (rid 91348) by kenj on 2003-04-16 06:03:19:

    1. icomment:
      Logged In: YES 
      user_id=260635
      
      I'll check out these cases in a couple of days. Right now, I've 
      got a tight deadline on a project preventing me from spending 
      much time on this.
      
      
    2. login: "kenj"
    3. mimetype: "text/plain"
    4. username: "kenj"
  7. Ticket change [99a0275def] (rid 110825) by kenj on 2003-04-16 06:04:42:

    1. icomment:
      Logged In: YES 
      user_id=260635
      
      I'll check out these cases in a couple of days. Right now, I've 
      got a tight deadline on a project preventing me from spending 
      much time on this.
      
      
    2. login: "kenj"
    3. mimetype: "text/plain"
    4. username: "kenj"
  8. Ticket change [5f190d4bbd] (rid 115756) by andreas_kupries on 2003-04-22 07:19:07:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Does not happen on Linux, tested for Tcl head (8.5a0),  and 
      revisions at Jan 27 and Jan 24.
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  9. Ticket change [b3386d8000] (rid 98485) by andreas_kupries on 2003-04-22 07:27:35:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Confirmed on Win/2k box here, for revision Jan 24. This 
      means that the changes done by Mo have nothing to do with 
      the problem. This is something in the original code.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  10. Ticket change [8e1fa18257] (rid 120058) by andreas_kupries on 2003-04-22 07:40:01:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      The system is confused about the threads ... The channel we 
      are close is managed by thread 0x660 (See statePtr-
      >managingThread, when in Tcl_CutChannel). However the 
      function itself gets the tsdPtr for thread 0x3bc (Determined by 
      looking at the managingThread item in the channel list so 
      found).
      
      So, we get the channel list for a thread different from the 
      thread actually managing the channel. Therefore the channel 
      is not found in the list, and tcl panics. That is what we see.
      
      ______
      Regarding help you (Ken) can provide ... Just compile Tcl and 
      Thread with --enable-symbols and the crash allows you to 
      directly jump into the MSVC++ debugger and inspect 
      variables, stack, etc.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  11. Ticket change [73a1148ea6] (rid 105069) by andreas_kupries on 2003-04-22 07:56:12:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Further looking into the stacktrace it seems as if the fileevent 
      handler script is called from the global eventloop 
      (vwait::forever), and _not_ from the thread-local thread::wait.
      So while the call happens we are in the main thread, and that 
      causes the confusion in the lower levels.
      
      I am quite sure, if I add asserts checking in channel 
      operations current thread against managing thread then I will 
      get a panic much earlier.
      
      This goes deeper into the notifier on windows. Arrgh.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  12. Ticket change [d1366c6bcf] (rid 113308) by andreas_kupries on 2003-04-22 08:00:40:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Passing on to DavyGrvy. I don't understand the Windows 
      notifier good enough. I asked Jeff, but he doesn't either.
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. priority changed to: "9 Immediate"
    5. username: "andreas_kupries"
  13. Ticket change [475021e658] (rid 99678) by andreas_kupries on 2003-04-22 08:01:04:

    1. assignee changed to: "davygrvy"
  14. Ticket change [1e751c8458] (rid 90980) by andreas_kupries on 2003-04-22 08:02:58:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Attaching my stacktrace.
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  15. Add attachment "stacktrace-718045.txt" [ae8df74a50] (rid 101661) by andreas_kupries on 2003-04-22 08:02:58.

  16. Ticket change [1765858422] (rid 122485) by andreas_kupries on 2003-04-22 08:02:59:

    1. icomment:
      
      
      File Added - 48369: stacktrace-718045.txt
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  17. Ticket change [0a9339257c] (rid 113847) by andreas_kupries on 2003-04-23 02:37:30:

    1. assignee changed to: "andreas_kupries"
    2. icomment:
      Logged In: YES 
      user_id=75003
      
      Comments by David in mail to me:
      
      My first guess would be SocketProc() calling Tcl_ThreadAlert
      () in
      win/tclWinSock.c probably because the socket wasn't 
      removed from the handler
      window with WSAAsyncSelect().
      
      During a transfer, does the generic layer remove all watch 
      masks and restore
      them on the other side?
      
      
      
      
      
    3. login: "andreas_kupries"
    4. mimetype: "text/plain"
    5. username: "andreas_kupries"
  18. Ticket change [e8beaa0a9c] (rid 104697) by andreas_kupries on 2003-04-23 02:45:54:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Looking around in the socket code ...
      
      (1) The windows socket system maintains its own list of 
      sockets per thread ... This list is not maintained by the 
      cut/splice operations BAD !! 
      
      (2) ... David is also correct that the cut/splice operations 
      never send SOCKET_SELECT messages, which change the 
      WSAAsyncSelect status of the socket, and the association 
      with a particular notifier HWND.
      
      And this explain s the problem. The various levels have 
      inconsistent info on where the channel is. The upper layers 
      have it transfered, but in the lower layers the channel is still 
      seeen in the main thread, especially notification events arrive 
      in the main thread HWND, and not in the other thread. This 
      then causes the event to be handled in the main thread and 
      from then on we know how that crashes.
      
      Note: Mo Dejongs latests changes in this area are an 
      approximation to get this done, by introducing platform 
      specific cut/splice ops. This is good, but does not reach far 
      enough.
      
      We have essentially per channel-type/platform specific ops to 
      manage.
      
      I have to extend my proto TIP about channel type initialization 
      during channel transfer and add channel type specific 
      cut/splice ops to handle this.
      
      Can't be done in the 8.4.3. timeframe IMHO anymore. First 
      should be 8.5, eventually a backport.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  19. Ticket change [ac1fa453d9] (rid 101238) by andreas_kupries on 2003-04-23 02:48:09:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      See also [ 593810 ] Channel Transfer crashes.
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  20. Ticket change [4da8b65214] (rid 127085) by andreas_kupries on 2003-04-23 06:24:13:

    1. assignee changed to: "das"
    2. icomment:
      Logged In: YES 
      user_id=75003
      
      Reassigning to Daniel for test of Mac changes.
      
      
      
    3. login: "andreas_kupries"
    4. mimetype: "text/plain"
    5. username: "andreas_kupries"
  21. Ticket change [27d8690efe] (rid 88594) by andreas_kupries on 2003-04-23 06:24:40:

    1. resolution changed to: "Fixed"
  22. Ticket change [f143cf0e80] (rid 109337) by hobbs on 2003-07-19 03:20:40:

    1. closedate changed to: "2003-07-18T20:20:40"
    2. closer changed to: "hobbs"
    3. icomment:
      Logged In: YES 
      user_id=72656
      
      moved to pending since we haven't heard - assuming 
      functional on Mac.
      
      
    4. login: "hobbs"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "hobbs"