EOSERV Bug Tracker > Bug #397: linux socket stays open after server shutdown

Bug #397: linux socket stays open after server shutdown

linux socket stays open after server shutdown
ID #397
Submitter perfect
Product EOSERV
Severity Normal
Status CLOSED, FIXED
Submitted 16th Oct 2015
Updated 17th Mar 2022
perfect Submitter 8 years, 29 weeks ago

On linux while shutting down the server for a reboot, the created socket stays open for approximately 2 minutes until expiring/cleaning up. (this is normal as I've read online)

Upon trying to start eoserv you'll receive an binding error saying already in use. You can either reboot the pc or wait 2 minutes.

too correct this you can set a socket option "SO_REUSEADDR" similar to what you have in Client::Bind() in Server::Bind() or something similar to that.

If you have a better solution to correct this behavior i'd be interested:)

Comments

Sausage Developer 8 years, 28 weeks ago

I don't believe just adding SO_REUSEADDR fixes it, the server is supposed to do a proper shutdown of all client connections before exiting.

You can work-around it while testing by logging out of the server before closing it.

Updated Status to CONFIRMED

perfect Submitter 8 years, 28 weeks ago

The client connections as far as i know do get shut down properly. (as far as i know).

When the server binds, and listens on ip 0.0.0.0(all) upon shutting down the server, the socket hangs around in TIME_WAIT before fully shutting down.

If you try to power on eoserv again, you get a:

[ERR] SocketBind already in use.

From Google: TIME_WAIT is normal. It's a state after a socket has closed, used by the kernel to keep track of packets which may have got lost and turned up late to the party.

So if that definition is correct, the socket has closed the connections properly??? :o

Sausage Developer 2 years, 6 weeks ago

I believe this is now fixed. SO_REUSEADDR is used and server shutdowns are done properly.

Updated Status to CLOSED, FIXED

Add Comment

Please don't post unless you have something relevant to the bug to say.
Do not comment to say "thanks" or "fix this please".

Please log in to add comments. EOSERV Bug Tracker > Bug #397: linux socket stays open after server shutdown