|
2026-10-22
| ||
| 17:19 | • Ticket [2840603fff] Tcl hangs or crashes with fileevent on too many sockets</i... artifact: f7dd47d764 user: serhiy.storchaka | |
|
2026-10-12
| ||
| 14:06 | • Closed ticket [2840603fff]. artifact: da1a6c26ad user: serhiy.storchaka | |
| 14:06 | • Ticket [2840603fff]: 3 changes artifact: 1fb15573c3 user: serhiy.storchaka | |
|
2009-08-19
| ||
| 21:39 | • New ticket [2840603fff]. artifact: 8d03a89608 user: eee | |
Tcl hangs or crashes with [fileevent] on too many sockets
Closed / Duplicate2840603fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 41 days ago
Descriptionplain2009-08-19 21:39:02
Tcl hangs if I try to use event-driven I/O on more than approximately 1024 channels, and if I use greatly more than that, Tcl crashes. I used ActiveTcl 8.5.6 and an 8.6b1.1 basekit from the teapot. Running on sparc Solaris 10.
gps suggested that the issue has to do with the FD_SETSIZE define of the select() system call, and suggested that the fix involved checking "if ( fd >= FD_SETSIZE)" in tclUnixNotfy.c:Tcl_CreateFileHandler()
# SAMPLE script that will coredump.
# (for a script that merely hangs, change the "3000" to "1100" or smaller)
proc accept {fd host port} {
puts "Got connection: $host:$host:$fd"
fileevent readable $fd [list read-data $fd]
}
proc read-data {fd} {
puts "$fd: [read $fd]"
}
for {set port 1} {$port < 3000} {incr port} {catch {socket -server accept $port} res; puts "$port:$res"}
puts "Now listening."
% vwait forever
serhiy.storchakawiki2026-10-12 14:06:31
This is the same problem as [c6897e6e6a]: the select() notifier uses
FD_SET without checking fd < FD_SETSIZE. Since 8.7 Linux,
the BSDs and macOS use the epoll or kqueue notifier, which have no such limit, but
platforms using the select notifier (e.g. Solaris and illumos) are still affected.
Closing as a duplicate of [c6897e6e6a], which has the analysis and proposed fixes.
serhiy.storchaka Closed ticket [2840603fff].
[History diff]2026-10-12 14:06:31
serhiy.storchaka Ticket [2840603fff]: 3 changes
[History diff]2026-10-22 17:19:24
Log in (anonymous is fine) to add a comment.