SO_REUSEADDR woes

Lazyweb,

  1. When I kill my WebSocket server, I have to wait 2+ minutes to restart it because the kernel (2.6.32 Centos 6.2) says my port is still in use. I've tried trapping the signal and calling disconnect on each client connection to no avail. Also no help: setsockopt($S, SOL_SOCKET, SO_REUSEADDR, 1).

    And this is a hassle because:

  1. Every few days this server code just goes catatonic. The process is alive but no longer accepting connections. I've added log messages to every callback, and there's no obvious triggering event that causes it to break; it just seems to happen... every now and then. At that point there's nothing to do but to kill and restart it, which sucks as per above. Attaching a gdb to it didn't tell me anything. How do you debug something like this?

Previously.

Tags: , , ,

  • Previously