rurkss
Phoenix Channel Disconnect with 1006 error
Hello, community!
We are faced a problem, phoenix sockets are reconnected randomly from time to time.
We try to debug and find out that the socket reconnecting because of some channel error( which we join after socket was connected).
We debug error which comes from channel, and it is “undefined”. By the time those reconnection take place, there are no more connection to that channel, i mean no one except this client has joined to the channel.
Here are screenshots of our debugs:
here we may see how socket joins a room for the first time, and than after 9 minutes get an error of channel and went to reconnect whole socket and join room again:
Part 2.
we dig deeper and found out that phoenix close connection with code 1006, see screenshot below, but what does that means? it works fine for several minutes and than goes to disconnect
Please share your thoughts about how to dig into the problem, how to debug such kind of errors and log them
Most Liked
chrismccord
And for others reading this, to be clear the phoenix.js client automatically recovers from dropped websocket connections, which can happen for all kinds of reasons even if the server had no fixed window drop, so the client has you covered ![]()
jesse
I wonder if something is “timing out”. Do you know if the websocket connection is inactive during this time? Either way, it’s something we will investigate today. 10min is a suspiciously round number. Something is probably configured wrong somewhere.
jesse
Thanks @josevalim and @chrismccord; that helped narrow it down. I’ve narrowed the problem down to the nginx ingress controller which resets websocket connections when its config is reloaded. Unfortunately, under Kubernetes, the config is reloaded quite often. I’m investigating a few options to fix or workaround this issue such as dynamic configuration.
@rurkss if the websocket is being reconnected automatically, is this causing an end-user problem for you right now? If so, I could simply bump the timeout from 10min up to something like 30min. Would that help?
Last Post!
mreyk
Popular in Questions
Other popular topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









