[GH-ISSUE #76] Connection closing after aprox. 15 minutes #38

Open
opened 2026-05-05 10:58:08 -06:00 by gitea-mirror · 13 comments
Owner

Originally created by @rdelvalle on GitHub (Mar 13, 2018).
Original GitHub issue: https://github.com/mmatczuk/go-http-tunnel/issues/76

Hello. I've a client that after 15 minutes disconnects. In the client I don't see any log. This is what I see in the server:

2018/03/13 10:17:26 level 2 action open listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:121
2018/03/13 10:17:26 level 2 action open listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:122
2018/03/13 10:17:26 level 2 action open listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:123
2018/03/13 10:17:26 level 2 action open listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:124
2018/03/13 10:17:26 level 2 action set registry item identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB
2018/03/13 10:17:26 level 1 action connected addr 80.174.238.86:60705 identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB
2018/03/13 10:18:03 level 2 action proxy conn identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB ctrlMsg &{proxy [::]:121 tcp }
2018/03/13 10:18:04 level 3 action transferred bytes 5089 dir user to client dst UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB src 89.246.69.218:63109
2018/03/13 10:18:04 level 3 action transferred bytes 7910 dir client to user dst 89.246.69.218:63109 src UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB
2018/03/13 10:18:04 level 2 action proxy conn done identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB ctrlMsg &{proxy [::]:121 tcp }
2018/03/13 10:18:31 level 2 action proxy conn identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB ctrlMsg &{proxy [::]:121 tcp }
2018/03/13 10:18:33 level 3 action transferred bytes 5224 dir user to client dst UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB src 89.246.69.218:63113
2018/03/13 10:18:33 level 3 action transferred bytes 8062 dir client to user dst 89.246.69.218:63113 src UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB
2018/03/13 10:18:33 level 2 action proxy conn done identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB ctrlMsg &{proxy [::]:121 tcp }
2018/03/13 10:34:14 level 1 action disconnected identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB
2018/03/13 10:34:14 level 2 action clear registry item identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB
2018/03/13 10:34:14 level 2 action close listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:121
2018/03/13 10:34:14 level 2 action close listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:122
2018/03/13 10:34:14 level 2 action close listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:123
2018/03/13 10:34:14 level 2 action close listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:124
2018/03/13 10:34:14 level 2 action listener closed identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:124
2018/03/13 10:34:14 level 2 action listener closed identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:121
2018/03/13 10:34:14 level 2 action listener closed identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:122
2018/03/13 10:34:14 level 2 action listener closed identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:123

I tried with backoff: max_time: 0 but there was no difference.

Thanks!

Originally created by @rdelvalle on GitHub (Mar 13, 2018). Original GitHub issue: https://github.com/mmatczuk/go-http-tunnel/issues/76 Hello. I've a client that after 15 minutes disconnects. In the client I don't see any log. This is what I see in the server: ```` 2018/03/13 10:17:26 level 2 action open listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:121 2018/03/13 10:17:26 level 2 action open listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:122 2018/03/13 10:17:26 level 2 action open listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:123 2018/03/13 10:17:26 level 2 action open listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:124 2018/03/13 10:17:26 level 2 action set registry item identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB 2018/03/13 10:17:26 level 1 action connected addr 80.174.238.86:60705 identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB 2018/03/13 10:18:03 level 2 action proxy conn identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB ctrlMsg &{proxy [::]:121 tcp } 2018/03/13 10:18:04 level 3 action transferred bytes 5089 dir user to client dst UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB src 89.246.69.218:63109 2018/03/13 10:18:04 level 3 action transferred bytes 7910 dir client to user dst 89.246.69.218:63109 src UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB 2018/03/13 10:18:04 level 2 action proxy conn done identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB ctrlMsg &{proxy [::]:121 tcp } 2018/03/13 10:18:31 level 2 action proxy conn identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB ctrlMsg &{proxy [::]:121 tcp } 2018/03/13 10:18:33 level 3 action transferred bytes 5224 dir user to client dst UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB src 89.246.69.218:63113 2018/03/13 10:18:33 level 3 action transferred bytes 8062 dir client to user dst 89.246.69.218:63113 src UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB 2018/03/13 10:18:33 level 2 action proxy conn done identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB ctrlMsg &{proxy [::]:121 tcp } 2018/03/13 10:34:14 level 1 action disconnected identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB 2018/03/13 10:34:14 level 2 action clear registry item identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB 2018/03/13 10:34:14 level 2 action close listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:121 2018/03/13 10:34:14 level 2 action close listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:122 2018/03/13 10:34:14 level 2 action close listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:123 2018/03/13 10:34:14 level 2 action close listener identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:124 2018/03/13 10:34:14 level 2 action listener closed identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:124 2018/03/13 10:34:14 level 2 action listener closed identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:121 2018/03/13 10:34:14 level 2 action listener closed identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:122 2018/03/13 10:34:14 level 2 action listener closed identifier UJ72CAB-5LW5RVP-STCEAVM-TSJ2DSV-OM3PPAK-HY3Q5CL-L7Z2NNB-LRGQ7AB addr [::]:123 ```` I tried with backoff: max_time: 0 but there was no difference. Thanks!
Author
Owner

@mmatczuk commented on GitHub (Mar 13, 2018):

There must be some proxy in between that is cutting the connection.

<!-- gh-comment-id:372634188 --> @mmatczuk commented on GitHub (Mar 13, 2018): There must be some proxy in between that is cutting the connection.
Author
Owner

@rdelvalle commented on GitHub (Mar 13, 2018):

How can I debug that?

<!-- gh-comment-id:372636328 --> @rdelvalle commented on GitHub (Mar 13, 2018): How can I debug that?
Author
Owner

@rdelvalle commented on GitHub (Mar 13, 2018):

I think the issue is that the client doesn't know it's disconnected, so it doesn't retry.

<!-- gh-comment-id:372662105 --> @rdelvalle commented on GitHub (Mar 13, 2018): I think the issue is that the client doesn't know it's disconnected, so it doesn't retry.
Author
Owner

@rdelvalle commented on GitHub (Mar 13, 2018):

@mmatczuk Could it be that the keepalive for windows is not working? I'm using a tcp connection on Windows 7. Seems it closes after 15 minutes of no activity.

<!-- gh-comment-id:372692825 --> @rdelvalle commented on GitHub (Mar 13, 2018): @mmatczuk Could it be that the keepalive for windows is not working? I'm using a tcp connection on Windows 7. Seems it closes after 15 minutes of no activity.
Author
Owner

@mmatczuk commented on GitHub (Mar 13, 2018):

Are you running a release version or you build it yourself?

<!-- gh-comment-id:372694788 --> @mmatczuk commented on GitHub (Mar 13, 2018): Are you running a release version or you build it yourself?
Author
Owner

@rdelvalle commented on GitHub (Mar 13, 2018):

@mmatczuk I'm running the latest release windows_amd64

<!-- gh-comment-id:372696359 --> @rdelvalle commented on GitHub (Mar 13, 2018): @mmatczuk I'm running the latest release windows_amd64
Author
Owner

@rdelvalle commented on GitHub (Mar 14, 2018):

I also tried the x86 version without success.

<!-- gh-comment-id:372933333 --> @rdelvalle commented on GitHub (Mar 14, 2018): I also tried the x86 version without success.
Author
Owner

@mmatczuk commented on GitHub (Mar 14, 2018):

It's about the windows built. I'd suggest moving to linux :)

<!-- gh-comment-id:372966048 --> @mmatczuk commented on GitHub (Mar 14, 2018): It's about the windows built. I'd suggest moving to linux :)
Author
Owner

@rdelvalle commented on GitHub (Mar 14, 2018):

I myself use Linux and MacOS, but unfortunately, the computer where I want to add the tunnel uses Windows and I'll need to deal with it 😢. Do you think the problem is of the KeepAlive that the app is using or it's about the implementation of it?

<!-- gh-comment-id:372967993 --> @rdelvalle commented on GitHub (Mar 14, 2018): I myself use Linux and MacOS, but unfortunately, the computer where I want to add the tunnel uses Windows and I'll need to deal with it 😢. Do you think the problem is of the KeepAlive that the app is using or it's about the implementation of it?
Author
Owner

@mmatczuk commented on GitHub (Mar 14, 2018):

You would need to debug it, from what I see https://github.com/mmatczuk/go-http-tunnel/blob/master/keepalive_windows.go#L12 could be more like 2e9f2912ba/conn.go (L1130). You can also experiment with the timing https://github.com/mmatczuk/go-http-tunnel/blob/master/keepalive.go#L19.

<!-- gh-comment-id:372979103 --> @mmatczuk commented on GitHub (Mar 14, 2018): You would need to debug it, from what I see https://github.com/mmatczuk/go-http-tunnel/blob/master/keepalive_windows.go#L12 could be more like https://github.com/gocql/gocql/blob/2e9f2912ba58e37f34af3554659b576eac655760/conn.go#L1130. You can also experiment with the timing https://github.com/mmatczuk/go-http-tunnel/blob/master/keepalive.go#L19.
Author
Owner

@tianchaijz commented on GitHub (Nov 7, 2018):

@rdelvalle try my heartbeat branch: https://github.com/tianchaijz/go-http-tunnel

<!-- gh-comment-id:436514722 --> @tianchaijz commented on GitHub (Nov 7, 2018): @rdelvalle try my heartbeat branch: https://github.com/tianchaijz/go-http-tunnel
Author
Owner

@ice6 commented on GitHub (Jan 23, 2019):

@tianchaijz it is cool. I carefully read your code, and I think your implementation is quite good, why not make a pull request to merge back :)

I made such implementation using zeromq years ago, it is quite necessary for such a program.

the heartbeat version can easily pass the weak network test(switch network, close and reconnect network etc)

@mmatczuk
I just learn go recently, really happy to see such a wonderful/high quality open source projects.

Thanks
👍

<!-- gh-comment-id:456645186 --> @ice6 commented on GitHub (Jan 23, 2019): @tianchaijz it is cool. I carefully read your code, and I think your implementation is quite good, why not make a pull request to merge back :) I made such implementation using zeromq years ago, it is quite necessary for such a program. the heartbeat version can easily pass the weak network test(switch network, close and reconnect network etc) @mmatczuk I just learn go recently, really happy to see such a wonderful/high quality open source projects. Thanks 👍
Author
Owner

@apottere commented on GitHub (Apr 8, 2020):

@tianchaijz It would be awesome if you could PR your heartbeat work back to this project.

We're seeing this issue running tunneld in AWS, with clients connecting through an NLB. NLB disconnects clients that don't send any data for 350 seconds (source), so our clients get disconnected and have to be restarted if no requests are routed to them in that timeframe.

<!-- gh-comment-id:611020153 --> @apottere commented on GitHub (Apr 8, 2020): @tianchaijz It would be awesome if you could PR your heartbeat work back to this project. We're seeing this issue running `tunneld` in AWS, with clients connecting through an NLB. NLB disconnects clients that don't send any data for 350 seconds ([source](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#connection-idle-timeout)), so our clients get disconnected and have to be restarted if no requests are routed to them in that timeframe.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/go-http-tunnel#38
No description provided.