Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 92fff956899b8c4e52599da4dcb7159ec241c046
Ticket: 1847064fffffffffffffffffffffffffffffffff
Event loop goes CPU bound when select() invalid fd
User & Date: dnew on 2007-12-09 00:01:39
Changes

  1. assignee changed to: "nijtmans"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    I had a bug in a program that created outgoing sockets and didn't close them when they failed. Basically
      set x [socket -async machine.next.door 12345]
      puts $x $somedata
      flush $x ; #This threw, caught by bgerror
      close $x
    
    Eventually, however, I wound up with a large number of socket channels that were open but disconnected.
    
    Now, here's the funny part: After a while, the process would go compute bound. Using the lovely advice from CLT, I could "strace -p $pid" and see what it's doing.
    
    It's stuck in a tight loop with select() throwing errors because the socket number is out of range. 
    
    I can't seem to reproduce it in a trivial program. The code I actually use does set and unset the blocking flag at different parts of the protocol, which may have something to do with it.
    
    I wrote a little program that just opens a new async socket every second with [after], and it worked fine up past 256 sockets, whereas the big code was bombing out after 32 or 64, so I'm not sure what's different there. It might be a little harder to find than I thought. 
    
    info patchlevel give 8.4.14, and this is SuSE Linux 10.2 running the penultimate kernel (blah blah.5) 
    
    Feel free to contact me if I can help track this further.
    
    
    
  4. foundin changed to: "obsolete: 8.4.14"
  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: "dnew"
  10. subsystem changed to: "02. Event Loops"
  11. title changed to: "Event loop goes CPU bound when select() invalid fd"
  12. type changed to: "Bug"