-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web socket timeouts in 0.9.5 #1384
Comments
Yes, if you require longer connections, you should disable the default timeouts (or extend them to some arbitrarily longer value).
The release notes describe this: https://github.com/mholt/caddy/releases/tag/v0.9.5 |
I have read the release notes but I disagree that the read timeout should apply to websockets. The other use cases such as long polling are an abuse of http and would need a workaround but websockets are the standardised way to achieve bi directional communication. https://html.spec.whatwg.org/multipage/comms.html#ping-and-pong-frames defines the behaviour of ping pong specifically to keep the connection alive. The scope of timeout is per vhost and I would like it to not apply to websockets or have another timeout specific to webwockets. Another approach could be to disable the timeout whenever a websocket connection is established or switch to a websocket timeout. I'd be happy to implement this option and send a PR. |
Unfortunately, that's not the case. https://caddyserver.com/docs/timeouts:
Go lets us define timeouts at the HTTP server level, not for each connection. |
Understood. I just read golang/go#16100 and can see the issues. |
Yup, that's the main rub. I'm really interested in making things "just work" here. There's probably some way of doing it by subverting the standard library but... I'm not sure that's a good idea. |
The documentation does not. I don't read the release notes to figure out why my websockets aren't working, I read the websockets documentation. Please do not make "breaking" changes like this without updating the documentation. |
Hey Alfie, this is in the documentation: https://caddyserver.com/docs/timeouts
You should always read release notes before upgrading, though. Especially before 1.0.
I know this is inconvenient, sorry about that. But I do reserve the right to make breaking changes intentionally before version 1.0:
The post-1.0 compatibility guarantee is still being developed. As this is a security feature, I deemed it important enough to impose on users by default, as it follows Caddy's goal to be secure by default. It's being removed in the next release, though, because of some complex bugs/edge cases related to timeouts upstream in Go's standard library. Thanks for understanding. And for your patience. 😇 |
@mholt Hi.
Given these two, can we speculate about implementing custom timeouts without tweaking std? P.S. I am certainly having perfomance issues and random disconnections using caddy websocket proxy, but I am not ready to create a reproducable bug report (version is 0.9.5, timeouts set to none). |
@windymindy Timeouts will be disabled in the next release coming out in 2 days. And yes, those two problems are the main hangups right now (pun intended) with timeouts. Go 1.9 or even sooner releases might have some of the fixes we'll need to make timeouts more robust/useful. |
1. What version of Caddy are you running (
caddy -version
)?0.9.5
2. What are you trying to do?
Reverse proxy drone.io server web interface. I noticed that websockets were being closed and the web UI was not updating after a small time.
3. What is your entire Caddyfile?
Not working:
Working:
Test html:
4. How did you run Caddy (give the full command and describe the execution environment)?
./caddy
5. What did you expect to see?
Open web sockets do not close after 10 seconds.
I think I've narrowed it down to the new default 10s read timeout. Should web sockets bypass the read timeout since the socket state is known?
6. What did you see instead (give full error messages and/or log)?
Web socket is being closed by caddy after 10 seconds.
7. How can someone who is starting from scratch reproduce this behavior as minimally as possible?
Use the files and html above.
The text was updated successfully, but these errors were encountered: