elixir-plug / plug_cowboy

Plug adapter for the Cowboy web server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection draining is not working 100% as expected

hauleth opened this issue · comments

Current implementation of connection draining works in a way that make it stop creating new connections, but that do not prevent existing connections from accepting and processing new requests. That mean that single client that is connected to the node will prevent it from going down (potentially disrupting any other client that tries to connect to the given node).

I do not know the solution (maybe this issue should be forwarded to Ranch or Cowboy) but maybe there already exists some solution in these deps that would allow handling such problem.

I cannot reproduce this behaviour. We check for draining every second and we have a shutdown of 5 seconds. After 5 seconds, the draining process is immediately killed and the rest of the shutdown continues. Cowboy/Ranch then propagates exit signals and terminates all children.

Even if that was not the case, I don't think there is a single-rule we can follow here. For example, Phoenix channels could likely be cleanly shutdown by sending a message to all active channels, which is probably a benefit we could add today.

Closing. Please let us know if there is a way to reproduce it. :)