Increase TCP timeout? #177

Closed
opened 2020-06-27 20:44:38 +00:00 by makeworld · 5 comments

From tb on the Gemini mailing list.

Bombadillo: I really like the look and feel of the browser, and accessing a few sites (especially gemini.circumlunar.space) is very quick. But most other gopher and gemini sites (eg: bombadillo.colorfield.space) seem to be unreachable. I get a TCP time-out after 5 seconds. This is tough, since my "broadband" connection is pretty slow.

From `tb` on the Gemini mailing list. Bombadillo: I really like the look and feel of the browser, and accessing a few sites (especially gemini.circumlunar.space) is very quick. But most other gopher and gemini sites (eg: bombadillo.colorfield.space) seem to be unreachable. I get a TCP time-out after 5 seconds. This is tough, since my "broadband" connection is pretty slow.
Owner

I respond to the poster directly and will update here with more details when I receive a response. Thank you @makeworld for forwarding the message!

If I remember correctly, gopher uses a timeout (likely of 5 seconds). Gemini, however, does not use a timeout at all (or at least not one I have set). This is due to the way the Golang TLS lib is set up. There is a way to add a timeout to a gemini request, I just need to set it up. I have felt liket he gemini timeout is too long though.... so had planned on shortening it (or making it match the gopher timeout). I'm definitely ok with a longer than 5 second timeout and will adjust both accordingly once more details arrive.

@makeworld have you had similar issues?

I respond to the poster directly and will update here with more details when I receive a response. Thank you @makeworld for forwarding the message! If I remember correctly, gopher uses a timeout (likely of 5 seconds). Gemini, however, does not use a timeout at all (or at least not one I have set). This is due to the way the Golang TLS lib is set up. There _is_ a way to add a timeout to a gemini request, I just need to set it up. I have felt liket he gemini timeout is too long though.... so had planned on shortening it (or making it match the gopher timeout). I'm definitely ok with a longer than 5 second timeout and will adjust both accordingly once more details arrive. @makeworld have you had similar issues?
sloum added the
gopher
label 2020-06-27 21:18:55 +00:00
Author

You're welcome! I have not had similar issues, but likely my home connection is just faster than tb's.

In go-gemini (Amfora's gemini client lib), I setup a timeout like this.

conn, err := tls.DialWithDialer(&net.Dialer{Timeout: <time.Duration>}, "tcp", "example.com:1965", conf)

Although this is only a timeout for forming the TLS connection, it doesn't apply to reading the content.

I've set it to 15 seconds by default, although idk if that's good. Maybe this would be a good thing to add to the config file?

You're welcome! I have not had similar issues, but likely my home connection is just faster than tb's. In [go-gemini](https://github.com/makeworld-the-better-one/go-gemini) (Amfora's gemini client lib), I setup a timeout [like this](https://github.com/makeworld-the-better-one/go-gemini/blob/779b008aaeb5c33adc922ecbd5ec1d440e82f5d6/client.go#L99). ```go conn, err := tls.DialWithDialer(&net.Dialer{Timeout: <time.Duration>}, "tcp", "example.com:1965", conf) ``` Although this is only a timeout for forming the TLS connection, it doesn't apply to reading the content. I've set it to 15 seconds by default, although idk if that's good. Maybe this would be a good thing to add to the config file?
Owner

I heard back on the e-mail and it seems that gemini connected fine for him, but that gopher was not loading things due to a slow connection and a short timeout.

In the short-term I suggested he updated line 52 of gopher/gopher.go with a timeout value more suitable to his use case.

However, it brings up the idea of maybe adding a configuration option to allow users to set their timeouts. For that to be truly useful I should also have gemini opperate with a timeout using that value.

I'll incorporate the code you provided above in the short term and try to find time to work on a config option. I'll keep this issue open while doing so :)

Thanks for the info!

I heard back on the e-mail and it seems that gemini connected fine for him, but that gopher was not loading things due to a slow connection and a short timeout. In the short-term I suggested he updated line 52 of gopher/gopher.go with a timeout value more suitable to his use case. However, it brings up the idea of maybe adding a configuration option to allow users to set their timeouts. For that to be truly useful I should also have gemini opperate with a timeout using that value. I'll incorporate the code you provided above in the short term and try to find time to work on a config option. I'll keep this issue open while doing so :) Thanks for the info!
Owner

This is being addressed in #178

That PR:

  • Adds a configuration option timeout
  • Updates gemini to use the snippet provided by @makeworld (above) for TLS timeouts
  • Updates gemini and gopher to both use a variable for their timeout that is tied to setting the timeout (in client.go)

Hopefully this gives users, in general, the ability to control this as they see fit.

I did just notice that I am not doing any check for a negative timeout. I should verify what happens with that before merging in (note to self).

This is being addressed in #178 That PR: - Adds a configuration option `timeout` - Updates gemini to use the snippet provided by @makeworld (above) for TLS timeouts - Updates gemini and gopher to both use a variable for their timeout that is tied to setting the timeout (in client.go) Hopefully this gives users, in general, the ability to control this as they see fit. I did just notice that I am not doing any check for a negative timeout. I should verify what happens with that before merging in (note to self).
sloum added the
gemini
label 2020-06-30 05:27:27 +00:00
sloum self-assigned this 2020-06-30 05:27:32 +00:00
sloum added the
in progress
label 2020-06-30 16:34:08 +00:00
sloum closed this issue 2020-09-06 15:20:55 +00:00
Owner

This has been merged into developas a user configurable option that affects gemini and gopher.

@makeworld do I remember you saying that go had released a breaking tls change? I cant seem to find a reference to the comment anywhere, but I should get that updated if need be...

This has been merged into `develop`as a user configurable option that affects gemini and gopher. @makeworld do I remember you saying that go had released a breaking tls change? I cant seem to find a reference to the comment anywhere, but I should get that updated if need be...
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
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: sloum/bombadillo#177
No description provided.