mirror of
https://github.com/mmatczuk/go-http-tunnel.git
synced 2026-05-15 14:16:17 -06:00
[GH-ISSUE #44] TCP proxy connection remains open (CLOSED_WAIT) #22
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/go-http-tunnel#22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @goriccardo on GitHub (Nov 14, 2017).
Original GitHub issue: https://github.com/mmatczuk/go-http-tunnel/issues/44
In a client TCP Proxy, when a
localconnection is closed the function calltransfer(local, r, ...)does not return, effectively preventing thelocalconnection to be properly closed.To reproduce:
At least one connection marked CLOSED_WAIT is present.
A quick and dirty solution would be to close the response reader after the local connection dies:
@mmatczuk commented on GitHub (Nov 14, 2017):
I think it may be related to this https://github.com/mmatczuk/go-http-tunnel/blob/master/utils.go#L37
@goriccardo commented on GitHub (Nov 14, 2017):
The problem was more widespread than I initially thought as also the server is not closing the connections.
The fix I found is to make sure that when one transfer returns also its dual get closed. Here is my patch:
@mmatczuk commented on GitHub (Nov 14, 2017):
@goriccardo PTAL at https://github.com/mmatczuk/go-http-tunnel/pull/45
@mmatczuk commented on GitHub (Nov 14, 2017):
BTW the second patch would block forever as while sending the request pr is empty.
@goriccardo commented on GitHub (Nov 15, 2017):
#45 works for me, thanks.
@mmatczuk commented on GitHub (Nov 15, 2017):
Thanks!