Open manprint opened 5 months ago
Hi, I did further tests and when what I described above happens, this is in the sish server logs:
2024/06/17 - 18:58:35 | Accepted SSH connection for: 172.18.0.3:53570
2024/06/17 - 18:58:35 | HTTP forwarding started: http://test.dev.synclabapps.link -> /tmp/172.18.0.3_53564_80332338001 for client: 172.18.0.3:53564
2024/06/17 - 18:58:35 | HTTPS forwarding started: https://test.dev.synclabapps.link -> /tmp/172.18.0.3_53564_80332338001 for client: 172.18.0.3:53564
2024/06/17 - 18:58:35 | Error replying to port forwarding request: read tcp 172.18.0.2:2222->172.18.0.3:53564: use of closed network connection
2024/06/17 - 18:58:36 | EOF
2024/06/17 - 18:58:51 | Accepted SSH connection for: 172.18.0.3:35654
2024/06/17 - 18:58:51 | Login attempt: 172.18.0.3:35654, user fabio key: ssh-rsa (REDACTED)
2024/06/17 - 18:58:51 | Error setting up HTTPListener: error assigning requested subdomain to tunnel
Step to reproduce the issue:
1) start tunnel with autossh -M0 -p 2222 -R test:80:localhost:8080 dev.mydomain.link
2) wait for 30+ seconds for the gate time (AUTOSSH_GATETIME=30 (default)) to finish
3) repeatedly press or hold CTRL+C to stop sish session and autossh
I hope it helps you. Best, Fabio
sish will close unused connections (include closed ones) by default, unless you mess something up with your configuration.
Otherwise, you can try to set:
force-requested-subdomains = true,
Agree with setting force-requested-subdomains
.
I’m still looking into this as I’m wondering if maybe it has something to do with autossh’s monitor port.
Hi, I tried the setting you recommended, but it didn't work. The problem persists. I attach a video of the test case in which the problem is highlighted. I hope it can be of use to you.
https://github.com/antoniomika/sish/assets/162589296/33ca7a46-1c2a-47e3-820b-6e4eabdfc823
Best, Fabio
Hi @antoniomika
In the past weeks I did some tests and with the help of a developer friend of mine, we found a way to solve the issue.
We added, to line 64 of sshmuxer/channel.go and to line 87 of utils/conn.go a sleep of 3 seconds.
In this way, the issue disappears: reconnections and stop/start tunnel with autossh work correctly.
I attach the modified files.
I did not make a pull request, because I think the fix is dirty, surely you will have a better and more elegant way to solve the problem :D
Best, Fabio.
Hello, Just to confirm we see same behaviour on our side. It can also be triggered when autossh have to reconnect due to a disconnection. When the error "The alias xyz is unavailable", the only fix we found at the moment is to restart sish. Regards, Léo
Hi @antoniomika,
I think I found an issue when using sish with autossh. After starting sish with autossh with the following command, for example:
When you want to stop the tunnel, since autossh automatically reconnects the tunnel, you have to press CTRL+C several times in rapid succession to stop sish session and exit autossh.
if you try to reconnect to the same domain sish says:
In order to reuse the blocked domain, sish must be restarted the problem is probably due to the fact that sish is very quick to reconnect. I managed to replicate the issue several time.
A possible solution to mitigate the problem could be a parameter to delay the ssh connection when ssh is invoked? (--ssh-connection-delay=5s)
If you need to do further tests I can help you.
Best, Fabio.