-
Notifications
You must be signed in to change notification settings - Fork 18k
net: goroutine permanently stuck in waitWrite() and waitRead() on tcp conn #27752
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
Comments
Stopping it how? More detail would be helpful.
|
Yeah, I know Close Listener will not unblock operation on connections, but this connection showing waitwrite wait for We counted all the accepted connections, and while stop server by close Listener we wait for all the connections to finish the current request and quit at next request until the connection counter became 0. All works all right, until recently we saw a block too long so I get the stack trace to see what is blocking and found the waitWrite problem. |
This code has been improved in more recent releases. Is it possible for you to try Go 1.11? If it still fails we will need some instructions on how to reproduce the problem. |
I can give it a try, however, It rarely happens. Not sure it can be reproduced. |
I used the go1.10.4 version, and for days, another stuck happened as below:
and this connection has been closed actually. The OS is |
Thanks, but I'm going to make the same comment: This code has been improved in more recent releases. Is it possible for you to try Go 1.11? If it still fails we will need some instructions on how to reproduce the problem. |
Currently, we can not use Go 1.11. I thought currently Go 1.10 release is still supported until 1.12 release. So will it be fixed if it happened in 1.10 but not in 1.11? |
Hi @absolute8511 - please have a look at our backport policy https://github.com/golang/go/wiki/MinorReleases. That said, if you can try out 1.11, we will know that it has been fixed in 1.11, which will give us a better visibility into the bug and a possible decision whether to backport it to 1.10 or not. Thank you. In any case, you haven't provided any sample code along with instructions that reproduces the issue. Without that, it is very hard to debug this issue from our side. Could you help with that ? |
Basically, my code is a proxy which will accept connection from a client, and receive data from client then send data to the backend server and wait for the reply from the server.
|
Unfortunately we are unlikely to be able to solve this without a complete reproduction case. If you want to try to solve this yourself, try to recreate the problem while running the program under |
I saw no connections on the port while the hang up happened. Can you give any suggestion what I can do next to identify the problem if I see |
Looking at |
hi, @ianlancetaylor , recently I have encountered the same problem. Have you found the reason?
|
@gzcaimufu Unfortunately I have not found the reason. Nothing has changed since I said "Unfortunately we are unlikely to be able to solve this without a complete reproduction case." |
OK. Thanks for your reply. |
@ianlancetaylor @bradfitz hi, I see a comment in h2_bundle.go as below. I am not sure if this comment is related to above goroutine stuck error. Could you please have a look?
|
@gzcaimufu Thanks, but that comment is not related to this problem. That is a different level, and has to do with how a blocking TCP write will respond to request cancelation. |
@ianlancetaylor Thanks a lot! For goroutine stuck in internal/poll.runtime_pollWait(/usr/local/go/src/runtime/netpoll.go:173), can I set timeout for this function? I just don't want this to stuck the goroutine. I find that even I set timeout of http.Client, poll.runtime_pollWait still block for a long time. Please let me know if you have suggestions. Many thanks! |
@gzcaimufu I'm sorry, I would like to help, but it's very hard to give advice without knowing what the problem is. Yes, you can set a timeout for network connections in general; see the |
@ianlancetaylor OK, Thanks a lot! |
@absolute8511 I have the same problem. Have you solved it ? And I found that you are from China. |
I work around this by setting the timeout on Conn. What I am curious is why the block in go runtime after the OS closed the underlying TCP conn not how to keep the TCP active. |
I think I solved this problem.The reason is as I said above. Is not golang bug . |
@absolute8511 - It seems like you have worked around this issue. I will go ahead and close this because there is not enough information / repro steps for us to go ahead with this. Please feel free to report back with complete repro steps using Go 1.13 and output from |
I am using the
go 1.9.2
and OS is2.6.32-696.23.1.el6.x86_64 #1 SMP Tue Mar 13 22:44:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
. While stopping a TCP server we see a connection is stuck in waitWrite for too long as below:We use
lsof
to see no connection on this port already. Is this an issue related with Go to handle closed connection on write?I saw a similar issue #23604, but it is unixgram. But in my problem, I am using
l, err = net.Listen("tcp", laddr)
.The text was updated successfully, but these errors were encountered: