The timeout config seems to work on my local machine as it no longer disconnects.
BTW, I added a simple logging of the :reason in the terminate callback and upon timeouts I get as expected :timeout.
However, on the server, it doesn’t work..
Well, it seems the timeout config is taken into account as it doesn’t disconnect after the default 60s..
But it still disconnects a little bit later…
In fact it disconnects exactly 100s after the connection is established.. Or 100s after the last message sent or received.
And when it happens, the reason is {:error, :closed} which doesn’t tell much about what’s going on.
The fact it’s very regular (exactly 100s) makes me thing it’s not related to Phoenix but most probably to the server itself (probably Linux related config).. But I have no clue how to diagnose this.. The server is running Debian if it can help.
Is anyone have an idea on how to investigate?
Or where I can ask about this issue?
Thank you very much.
Edit:
I read about TCP keepalive settings: Using TCP keepalive under Linux
I have the same values 7200, 75 and 9 on both my machine and on the server. So I guess it’s something else..
I’m using a reverse proxy indeed which is caddy..
And now you mentioned this, it makes sense that my issue might be related to it..
However I’m not editing it and it seems the default is either 2m or 30s: reverse_proxy (Caddyfile directive) — Caddy Documentation
In my case I have a consistent 100s..
I’m having similar issues. The timeout config doesn’t seem to have any effect.
In a local setup:
I tried setting it to 2s (not practical in the real world) to force connection error on my clients (local dev browsers / no reverse proxy in bw). However their socket connection doesn’t close / no failure in browser console. No presence leave event (on the other connected clients)
What I am trying to achieve: I want to change the default timeout so that connection loss, triggers a presence left event sooner than the defaults.
Background (How I got here): In production, I set it to 15s on server with 7.5s heartbeat on clients, but noticed no effect on the app (this setup does run behind caddy tho).
I think I’m getting confused bw heartbeat timeout (channel protocol), and keep-alive settings (http protocol).