Skip to content
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

"Resource temporarily unavailable" #1451

Closed
farao opened this issue May 16, 2020 · 4 comments
Closed

"Resource temporarily unavailable" #1451

farao opened this issue May 16, 2020 · 4 comments

Comments

@farao
Copy link

farao commented May 16, 2020

In seemingly random cases, a websocket connection to cowboy is closed before being able to send anything. I turned on the debug level in nginx reverse proxy to see what is different between a connection working out ok and one that gets closed. I found two differences. These lines were only present in the error case:

recv() not ready (11: Resource temporarily unavailable)
event timer: 16, old: 1589714909553, new: 1589714909554
http upstream request: "/?"
http upstream process upgraded, fu:0
event timer: 16, old: 1589714909553, new: 1589714909554
http upstream request: "/?"
http upstream process upgraded, fu:1
recv: fd:16 0 of 4096

But in both cases there were several of the "Resource temporarily unavailable" lines, so I don't know if that's the error.

Also quite often this was not there in the error case:

post event <someid1>
post event <someid2>
delete posted event <someid1>
...
delete posted event <someid2>

In general, post even and delete posted event lines were present also in the error case, simply a lot less.

Unfortunately, coming to cowboy now, in the websocket handler I only get these information:
reason: {:error, "closed"}
request: %{host: "<hostname>", method: "GET", path: "/", peer: {{127, 0, 0, 1}, 50306}, port: 80, qs: "", scheme: "http", version: :"HTTP/1.1"}

Interestingly, port 80 is neither the original public port (which is 443) nor the internal port that cowboy listens on (4240). I don't know if this could help.

How can I find out (e.g. in the websocket handler) more about the connection dropping / resource not available issue than the reason "closed"?

@essen
Copy link
Member

essen commented May 16, 2020

The port is the one from the request line so presumably it's just what is sent. Or the internal port is not using TLS and what is sent is the hostname without a port. In any case it's the URI port not the connection port which may differ based on your environment.

If you get {error, closed} then it's likely that the client closed the connection. Probably has to do with recv() not ready (11: Resource temporarily unavailable). I don't know what that means though.

@essen
Copy link
Member

essen commented May 20, 2020

I'll close this as I don't think the issue is in Cowboy. Please provide more information if it is.

@essen essen closed this as completed May 20, 2020
@farao
Copy link
Author

farao commented May 20, 2020

Ok, just one more question: is there any easy way to debug this in cowboy? (get more information than {:error, "closed"})

@essen
Copy link
Member

essen commented May 20, 2020

You can try tracing using dbg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants