|
From: SourceForge.net <no...@so...> - 2011-04-06 16:18:46
|
Feature Requests item #3276560, was opened at 2011-04-05 20:13 Message generated for change (Comment added) made by donc You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=351355&aid=3276560&group_id=1355 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Extend ANSI CL Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Don Cohen (donc) Assigned to: Sam Steingold (sds) Summary: econnreset error => subclass of eof Initial Comment: Right now, when a socket is reset by the peer, nothing exciting happens until you try to read past the last available input. At that point you get a OS error (ECONNRESET) which is not an EOF condition (I think it should be), and this further closes the fd, without marking the stream as closed (which I think it should not do). The result is that further attempts to use the stream give EBADF OS errors. Requests: - new condition class CONNECTION-RESET: (define-condition connection-reset (end-of-file) ()) - change in CLISP behavior s.t. ECONNRESET results in CONNECTION-RESET and not in OS-ERROR (or whatever) - don't close fd on ECONNRESET - it should act like other eof's - another attempt to read from the stream should cause another eof. Test code (at least for linux) This requires two lisp processes, one for the client, one for the server. I make use of the fact that closing a socket when there is still input available seems to result (again, only tested in linux) in a TCP reset rather than a FIN. The result of a FIN terminated connection is what I view as correct, so I will demonstrate that also. [server] (setf ss (socket:socket-server 1234)) [server] (setf s (socket-accept ss)) [client] (setf s (socket:socket-connect 1234)) [server-RST] (princ "asd" s) [client] (close s) at this point the stream is closed, either with FIN if the [server-RST] line is left out, or with RST if it is included [server] (read-char s) the result in FIN scenario is an EOF error, in the RST scenario it's *** - UNIX error 9 (EBADF): Bad file number [server] (read-char s) in the FIN scenario the result is another EOF error, in the RST scenario it's *** - UNIX error 9 (EBADF): Bad file number In both cases s appears to be an open stream, though in the RST scenario, the underlying fd has been closed. ---------------------------------------------------------------------- >Comment By: Don Cohen (donc) Date: 2011-04-06 16:18 Message: I now notice that the ECONNRESET OS-ERROR occurs on both read and write. I'd like to clarify that only reads should result in EOF errors, so the condition should perhaps be named to indicate some relation to eof or read, e.g., TCP-RESET-EOF, and ECONNRESET resulting from a write should not result in that particular condition. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=351355&aid=3276560&group_id=1355 |