-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add send/recv timeouts for the dispatcher on app sockets. #1356
Conversation
Reviewed 2 of 2 files at r1. c/dispatcher/dispatcher.c, line 472 at r1 (raw file):
You don't need to set c/dispatcher/dispatcher.c, line 478 at r1 (raw file):
Same as above. c/dispatcher/dispatcher.c, line 479 at r1 (raw file):
This actually solves a really nasty issue where a truncated packet would cause the dispatcher to hang. c/dispatcher/dispatcher.c, line 1200 at r1 (raw file):
You don't need to set c/dispatcher/dispatcher.c, line 1202 at r1 (raw file):
c/dispatcher/dispatcher.c, line 1206 at r1 (raw file):
You don't need to set c/dispatcher/dispatcher.c, line 1209 at r1 (raw file):
Comments from Reviewable |
The current dispatcher design will deadlock if an application is failing to read from its socket and that socket's buffer fills up. scionproto#1278 is the relevant issue. This patch adds a 2s read/write timeout for app sockets, after which the dispatcher will log an error and close the socket. This doesn't fully fix the issue, but it does mean the dispatcher can recover, and there will be clear logging to ease debugging, while hopefully avoiding any packet loss during normal operation. Also: - Fix a memory leak in parse_request.
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. c/dispatcher/dispatcher.c, line 472 at r1 (raw file): Previously, scrye (Sergiu Costea) wrote…
It's not quite that simple. See https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152351 for some background. I've ran into the problem too many times where a stale non-zero errno caused a program (or humans, reading the logs) to believe an error had occurred. So as a matter of principle i try to set it to 0 before a call if it's going to be used in the error handling/reporting after the call. That way it is unambiguous where/when the errno was set, and there can't be confusion about stale values. c/dispatcher/dispatcher.c, line 1200 at r1 (raw file): Previously, scrye (Sergiu Costea) wrote…
That's not guaranteed, c/dispatcher/dispatcher.c, line 1202 at r1 (raw file): Previously, scrye (Sergiu Costea) wrote…
Done. c/dispatcher/dispatcher.c, line 1209 at r1 (raw file): Previously, scrye (Sergiu Costea) wrote…
Done. Comments from Reviewable |
Reviewed 2 of 2 files at r2. c/dispatcher/dispatcher.c, line 472 at r1 (raw file): Previously, kormat (Stephen Shirley) wrote…
The link refers to C standard library calls; those are generally more complex, and do fancier stuff with Nearly all syscall wrappers from the Linux API (like the one below) have the same behavior, returning I find In any case, we can leave it as is. c/dispatcher/dispatcher.c, line 1200 at r1 (raw file): Previously, kormat (Stephen Shirley) wrote…
Hmm, then those logic errors cannot be told apart based on the logging message below. I'm fine with leaving them as is; the dispatcher's error handling is quite flaky in multiple places and spending time on it isn't a priority. Comments from Reviewable |
…#1356) The current dispatcher design will deadlock if an application is failing to read from its socket and that socket's buffer fills up. scionproto#1278 is the relevant issue. This patch adds a 2s read/write timeout for app sockets, after which the dispatcher will log an error and close the socket. This doesn't fully fix the issue, but it does mean the dispatcher can recover, and there will be clear logging to ease debugging, while hopefully avoiding any packet loss during normal operation. Also: - Fix a memory leak in parse_request. - Log assigned port when request was for port 0
The current dispatcher design will deadlock if an application is failing
to read from its socket and that socket's buffer fills up.
#1278 is the relevant issue.
This patch adds a 2s read/write timeout for app sockets, after which the
dispatcher will log an error and close the socket. This doesn't fully
fix the issue, but it does mean the dispatcher can recover, and there
will be clear logging to ease debugging, while hopefully avoiding any
packet loss during normal operation.
Also:
This change is