问题
After stopping an EWF app and starting it again in a Address already in use: c_bind
Address already in use: IO_FAILURE raised
As explained here, it seems that TCP socket timeout is not available for some time before being released by OS.
回答1:
The best workaround I found is
sudo sh -c 'echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle'
Credits to this answer
I believe that the idea of the socket being unavailable to a program is to allow any TCP data segments still in transit to arrive, and get discarded by the kernel. That is, it's possible for an application to call close(2) on a socket, but routing delays or mishaps to control packets or what have you can allow the other side of a TCP connection to send data for a while. The application has indicated it no longer wants to deal with TCP data segments, so the kernel should just discard them as they come in.
did change things. The second "opener" only took about 3 seconds to get its new socket.
来源:https://stackoverflow.com/questions/53932111/eiffel-web-framework-app-run-on-linux-raises-address-already-in-use-io-failur