-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
*: close TCP listener after breaking the accept() loop #1135
Conversation
interesting.
when the listener accept new connection failed, he will break the for loop and he will never process the new tcp connection, in your fix, we stop the tcp listener, but other http listener is still alive, this process is also alived, perhaps use nsq/internal/protocol/tcp_server.go Lines 15 to 36 in cbdcd54
|
hi, @mdh67899 when this error occurred, the http listener will be closed, refer to https://golang.org/src/net/http/server.go?s=93229:93284#L2811
|
Something here needs to be fixed, so thanks for raising the issue! I tend to lean towards @mdh67899's suggestion:
The fact that the |
@mreiferson I think the the if you think this is a good idea, I am glad to submit a pull request to implement this function, thanks. |
I think we would want to use the existing |
Agreed.
What we need to do is for nsqd to do a graceful shutdown whereas for nsqlookupd, a simple exit will be ok. As we use systemd, or some other process monitor system, to run nsqd, nsqd will be restarted after an exit. |
Let's continue this discussion in #1138 where we're close to consensus on the approach, thanks everyone! |
We got an error from accept() loop:
[nsqd] xx ERROR: listener.Accept() - accept tcp [::]:4750: accept4: too many open files in systeme
but we found that the tcp listener was not closed properly (like net.httpserver). And connections from clinets got a lot of
io timeout
instead ofconnection refused