Reuse unix sockets (UDS) and don't try to serve HTTP/3 over UDS #5063
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR hopefully fixes #5056 - any use of Unix domain sockets (UDS) cause errors now because somehow I missed that SO_REUSEPORT doesn't apply to UDS, even though it's a socket too.
My testing didn't catch this before because I didn't attempt to do a config reload with unix sockets specifically.
To test this, I created a simple server:
(I also enabled
debug
mode for my tests, but not required.)I also added
time.Sleep(1 * time.Second)
to thestatic_response
handler (respond
directive) between writing headers and the body, to simulate a slow request-response. (I also repeated the tests without this sleep successfully.)I started the server, then I ran this bash loop:
to get "Hello world".
At the same time I ran this loop:
to rapidly change the config. This should put the reload code (and unix socket reuse) through its paces.
I observed 0 errors, 0 failed requests, and 0 resource leaks (I used
localhost:2019/debug/pprof
to watch goroutines and I also used the system monitor to measure memory use).For HTTP/3 support on UDS, we having an upstream discussion: quic-go/quic-go#3560
I don't expect the tests to pass for all platforms yet. I just found out Go has a new
unix
build tag that I'm trying out.