Dropped data on socket (stream) read
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
On Windows, if a client connects to a server, writes some data, and closes the socket, and the server writes some data after the socket has been closed, a subsequent read will fail to read the data and goes straight to EOF. This problem doesn't occur on Linux. CCL also exhibits this bug, so this is likely a Windows API quirk.
sbcl version: 1.3.9, 1.3.12 (a 1.4.0 build isn't available for windows)
Windows 7 SP1, 32-bit
*FEATURES*:
(:QUICKLISP :ASDF-PACKAGE-
:NON-BASE-
:ASH-RIGHT-VOPS :C-STACK-
:CYCLE-COUNTER :FP-AND-
:INLINE-CONSTANTS :LINKAGE-TABLE :LITTLE-ENDIAN :MEMORY-
:MULTIPLY-
:PACKAGE-
:SB-DYNAMIC-CORE :SB-EVAL :SB-FUTEX :SB-LDB :SB-PACKAGE-LOCKS :SB-QSHOW
:SB-SAFEPOINT :SB-SAFEPOINT-
:SB-THRUPTION :SB-UNICODE :SB-WTIMER :SBCL :STACK-
:STACK-
:STACK-
:UNWIND-
Test code -- call SBCL-READ-IT, then SBCL-WRITE-IT from a second process:
(defun sbcl-read-it ()
(let ((srv-sock (make-instance 'sb-bsd-
(sb-
(sb-
(let* ((sock (sb-bsd-
(stream (sb-bsd-
(
(progn
;; Wait for the client to close the socket.
(sleep 1)
;; If this write is commented out, everything works normally.
(let ((sequence (make-array 1 :element-type '(unsigned-byte 8))))
;; With the write above, this returns 0 bytes read; without it, reads a byte.
(
(
(defun sbcl-write-it ()
(let ((sock (make-instance 'sb-bsd-
(sb-
(unwind-protect
(progn
(let ((stream (sb-bsd-
(format stream "Rhubarb")
(