Repository navigation
Conversation
This prevents errors such as
tcp-read: error reading
system error: Connection reset by peer; errno=54
errortrace...:
context...:
/Applications/Racket v7.4/collects/racket/port.rkt:1160:4: try-again
from appearing in application output after clients terminate their
connections abruptly (without sending a FIN packet).
This code can be used to exercise the problem:
#lang racket
(require racket/tcp)
(for ([_ (in-range 100)])
(define-values (in out)
(tcp-connect "127.0.0.1" 8000))
(parameterize ([current-output-port out])
(displayln "GET / HTTP/1.1")
(displayln "")
(flush-output))
(read-string 100 in)
(tcp-abandon-port in)
(tcp-abandon-port out))
|
For reference, the thread in which the exception gets raised is here: https://github.com/racket/racket/blob/ca2eafbfc404207b4f8d5b1423dc1f7bb48afcef/racket/collects/racket/port.rkt#L1142-L1146 . Perhaps that code could also be updated to handle this case a bit better? cc @mflatt |
It doesn't appear that the way the loop was previously set up was buying us anything over this simpler version.
|
I realized I could simplify the whole connection loop by ditching all of the |
The client socket might get closed while we're blocking on the peek so this change ensures that we handle that particular case gracefully.
|
I think there's confusion here about Adding a Meanwhile, there really should be no difference to using |
That's a good point I hadn't considered. I'll take another look at this tomorrow with that in mind just to be sure I didn't miss anything with the latter changes. Thanks!
You're right that they are both susceptible to running into resets. The difference is that |
|
Ah, I see. That does sound like a bug in |
Propoagate read errors to the `sync` that is applied to an event, instead of writing the events to stdout. Related to racket/web-server#76
Propoagate read errors to the `sync` that is applied to an event, instead of writing the events to stdout. Related to racket/web-server#76
This prevents errors such as
from appearing in application output after clients terminate their connections abruptly (without sending a FIN packet).
This code can be used to exercise the problem: