boazsegev/iodine

[0.7.40] Hot restart results in connection refused

Shelvak opened this issue · 1 comments

System Information

  • OS: Archlinux Kernel-5.6.16-1 and Alpine3.11 in cluster
  • Ruby: 2.7.0 && 2.7.1
  • Version: 0.7.40
  • OpenSSL: OpenSSL 1.1.1g 21 Apr 2020

Description

After hot restart I'm getting connection refused after that (in development and in production too). I tested on 0.7.39 and everything looks fine.

Rails App to Reproduce

# initializer
Iodine.run_every(1 * 60 * 1000) do # 1 minute for test
  Process.kill('SIGUSR1', Process.pid) unless Iodine.worker?
end

Testing code

curl -v http://localhost:3000/ # without restart
=> < HTTP/1.1 200 OK....

# Wait until restart
curl -v http://localhost:3000/
=>
*   Trying ::1:3000...
* connect to ::1 port 3000 failed: Conexión rehusada
*   Trying 127.0.0.1:3000...
* connect to 127.0.0.1 port 3000 failed: Conexión rehusada
* Failed to connect to localhost port 3000: Conexión rehusada
* Closing connection 0
curl: (7) Failed to connect to localhost port 3000: Conexión rehusada

Expected behavior

After restart accept connections again

Actual behavior

Reject any connection.

Hi @Shelvak ,

Thank you for opening this issue!

The issue was caused by the improved cleanup cycles (which were also closing the listening sockets on the master process by mistake).

I fixed the issue to relax the cleanup algorithm to allow open sockets without attached protocols to remain active... this isn't ideal since it assumes the code regarding connection protocol assignment has no issues (which modular code should never assume), but it's the previous behavior and will remain this way probably until an 0.8.x release.

Thanks again!
Bo.