#596 Bug in Windows sockets

obsolete: 8.0p2

OriginalBugID: 611 Bug
Version: 8.0p2
SubmitDate: '1998-05-21'
LastModified: '1998-06-04'
Severity: MED
Status: Released
Submitter: stanton
ChangedBy: stanton
OS: All Windows
OSVersion: NA
Machine: NA
FixedDate: '2000-10-25'
FixedInVersion: 8.0.3
ClosedDate: '1998-06-04'

In a conversation with Bob Lamoureux of Bridge Information Systems
yesterday, he reported the following bug:

In the Tcl socket code for Windows, there is apparently a call to
ioctl(FIONREAD) to "peek" on the socket to see how many bytes are
ready. The Microsoft code that implements this function doesn't
properly handle the case where the ready data spans more than one
buffer. Apparently, it works by reading all of the available input
data, counting the bytes, then pushing all of the data back into
the buffers. However, it apparently isn't possible to push back more
than one bufferfull of data, so any data beyond the first buffer is
lost. After the ioctl call Tcl tries to read the data, which hangs
since there isn't enough data there anymore. It sounds like this
may even hang the system (it hangs low enough in the kernel to make
it hard to interrupt). Bob tracked it down with the help of
Microsoft engineers, who then said it was a known problem and it's
our fault for trying to port Unix code to Windows (sheesh).

Anyhow, the solution is probably to change the socket code to spin a
thread like pipes and serial lines, so that it isn't necessary to
"peek" on the socket.


  • Brent B. Welch
    Brent B. Welch

    • priority: 5 --> 2
    • status: open --> closed-fixed
  • Don Porter
    Don Porter

    • labels: 104250 --> 27. Channel Types