Comments (6)
You can disable the idle connection logic by setting idle-connection=false
either in the command line or in your sish config.
from sish.
Thanks, but this issue shows that the idle connection logic is implemented wrong. The documentation says Duration to wait for activity before closing a connection for all reads and writes (default 5s)
, but in the example the connection is closed after 5 seconds regardless of activity
from sish.
The idle timeout exists for both sides of the tunnel. If one side of the tunnel (the writer) doesn't receive any messages, the connection is considered dead. This is currently implemented with golang's connection deadlines, which doesn't really have a way to apply deadlines differently (single deadline which includes read or write as extending the deadline). This is the expected behavior of how this is implemented.
We could maybe make sish smarter by looking for when a deadline occurs and having retry logic in if the other side of the connection has still not hit its deadline, but this feature can just as easily be disabled and timeouts handled by the ping timeout instead
from sish.
I'm gonna open a PR with https://github.com/antoniomika/sish/blob/main/utils/conn.go#L181 changed to just call SetDeadline
instead of the individual read or write deadlines. This would theoretically push both deadlines continuously as either read or write is called. Mind helping me test out those changes @bibo38 ?
from sish.
Thanks. Pushing both deadlines solves my problem 👍
Here is the diff that worked for my downloading file usecase:
diff --git a/utils/conn.go b/utils/conn.go
index 45b1df1..6927c94 100644
--- a/utils/conn.go
+++ b/utils/conn.go
@@ -184,7 +184,7 @@ type IdleTimeoutConn struct {
// Read is needed to implement the reader part.
func (i IdleTimeoutConn) Read(buf []byte) (int, error) {
- err := i.Conn.SetReadDeadline(time.Now().Add(viper.GetDuration("idle-connection-timeout")))
+ err := i.Conn.SetDeadline(time.Now().Add(viper.GetDuration("idle-connection-timeout")))
if err != nil {
return 0, err
}
@@ -194,7 +194,7 @@ func (i IdleTimeoutConn) Read(buf []byte) (int, error) {
// Write is needed to implement the writer part.
func (i IdleTimeoutConn) Write(buf []byte) (int, error) {
- err := i.Conn.SetWriteDeadline(time.Now().Add(viper.GetDuration("idle-connection-timeout")))
+ err := i.Conn.SetDeadline(time.Now().Add(viper.GetDuration("idle-connection-timeout")))
if err != nil {
return 0, err
}
Handling the errors is probably also a good idea to print meaningful status errors like The [HTTP/SSH/TCP] connection with X was longer than Y idle and therefore terminated
, instead of a panic (which let's you think it's a bug in sish).
from sish.
Cool! Appreciate you went through building and testing. I'll make a PR and get a version patched!
from sish.
Related Issues (20)
- Usage guide via SSH HOT 1
- websocket connections will be closed once a while HOT 1
- Sish sometimes doesn't clean connections properly HOT 4
- Reconnect same tunnel HOT 1
- How many max connections it can hold? HOT 1
- sish SSH question
- Force reset connection HOT 10
- Certificate provisioning issues
- URL string replacement in the returned HTML HOT 1
- [Feature-Request] - Record notes when starting a tunnel
- Multiple http/tcp ports on same subdomain HOT 3
- Can I use IP configuration? I have no domain name
- channel 0: open failed: connect failed: Temporary failure in name resolution stdio forwarding failed
- Feature request: allow reading password from file HOT 3
- Run behind SSL terminating proxy HOT 1
- how to disable random subdomain. HOT 1
- Is it possible to run it in debain or openwrt running in Rasberry Pi HOT 7
- cannot get sish to work, connection refused or hangs HOT 1
- [Support] Where to start for adding authentication features HOT 2
- [Question] - Keep the connection stable and avoid client restart HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sish.