Can't reopen server port after crash

Questions about Wine on Linux
Locked
vspin
Level 2
Level 2
Posts: 14
Joined: Thu Dec 31, 2020 2:27 am

Can't reopen server port after crash

Post by vspin »

I have an old multiplayer game server, and hackers can crash the game server via telnet. That's not the problem. When I run the game server on a specific TCP port, and intentionally crash the server myself, the game server exits, and reopens (by design), however, the server cannot seem to listen on the port again (nothing listening) until about 1 min passes. I can close the game server and reopen it but it does listen on the port until the minute passes.

Is there anything with WineHQ I can kill, or do to solve this problem?


Thank you.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Can't reopen server port after crash

Post by Bob Wya »

vspin wrote: Thu Dec 31, 2020 2:37 am ...
Is there anything with WineHQ I can kill, or do to solve this problem?
...
@vspin

They may be a delay in tearing down the currently running wineserver process.

Take a look at the parameters for wineserver:

Code: Select all

wineserver --help
Usage: /usr/lib/wine-vanilla-6.0_rc3/bin/wineserver [options]

Options:
   -d[n], --debug[=n]       set debug level to n or +1 if n not specified
   -f,    --foreground      remain in the foreground for debugging
   -h,    --help            display this help message
   -k[n], --kill[=n]        kill the current wineserver, optionally with signal n
   -p[n], --persistent[=n]  make server persistent, optionally for n seconds
   -v,    --version         display version information and exit
   -w,    --wait            wait until the current wineserver terminates

The --wait option is used, in a number of places, by the winetricks helper script.
The persistent and foreground options might also be of use to you.

Good luck! :lol:

Bob
vspin
Level 2
Level 2
Posts: 14
Joined: Thu Dec 31, 2020 2:27 am

Re: Can't reopen server port after crash

Post by vspin »

Bob Wya wrote: Thu Dec 31, 2020 9:40 am They may be a delay in tearing down the currently running wineserver process.

Take a look at the parameters for wineserver:

...

Good luck! :lol:

Bob
Thank you much for your time. I think I figured out the problem here: viewtopic.php?f=8&t=22758. Client sockets are in TIME_WAIT, and timeout in 60 seconds.

Because I don't have the game server's source code, I cannot make the necessary changes in the code to make it work as desired. I found two utilities that say they can kill connections on a port in TIME_WAIT: tcpkill and killcx. I'm checking them out now..
vspin
Level 2
Level 2
Posts: 14
Joined: Thu Dec 31, 2020 2:27 am

Re: Can't reopen server port after crash

Post by vspin »

I may be wrong. When I run the following command to check for sockets in TIME_WAIT state, I get no results:

netstat -n|grep TIMED_WAIT|grep 1849
vspin
Level 2
Level 2
Posts: 14
Joined: Thu Dec 31, 2020 2:27 am

Re: Can't reopen server port after crash

Post by vspin »

Nevermind, I was wrong. The socket does remain in TIME_WAIT state for 60 seconds. I'm going to give the following utility a try, and see if I can get it to kill all the connections.

https://github.com/arut/linux-tcp-drop
vspin
Level 2
Level 2
Posts: 14
Joined: Thu Dec 31, 2020 2:27 am

Re: Can't reopen server port after crash

Post by vspin »

I was able to successfully kill all tcp sockets in TIME_WAIT state using https://github.com/milabs/drop-tcp-sock with the command below. Now everything is working. :)

netstat -t -n | grep [port] | awk '{print $4"\t"$5}' >/proc/net/tcpdropsock
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Can't reopen server port after crash

Post by Bob Wya »

vspin wrote: Thu Dec 31, 2020 7:13 pm I was able to successfully kill all tcp sockets in TIME_WAIT state using https://github.com/milabs/drop-tcp-sock with the command below. Now everything is working. :)

Code: Select all

netstat -t -n | grep [port] | awk '{print $4"\t"$5}' >/proc/net/tcpdropsock
Nice catch! That's a useful kernel module. 8)

Bob
Locked