XMLRPC Port changes after restart ?!

Moderator: NADEO

Nicklander
Posts: 29
Joined: 20 May 2018, 01:41

XMLRPC Port changes after restart ?!

Post by Nicklander » 16 Jun 2019, 13:05

I set up cronjobs to restart the server and Maniacontrol once every day.
Most of the time it works fine but on some days something weird happens and the plugin won't load anymore.

I set a default XMLRPC port in the config but on some days, after a restart, it happens that this port changes and goes up +1 !?
Because of this weird port change, the plugin is no longer able to load (makes sense)...

I thought that it might have something to do with timeout or the port still being blocked after the server had been shut down ?!
Does the Maniaplanet server add +1 to the xmlrpc port if the default port in the config is blocked/not available/already used ?
Last edited by Nicklander on 16 Jun 2019, 13:49, edited 1 time in total.

User avatar
sotn0r
Posts: 87
Joined: 13 Mar 2011, 15:57
Contact:

Re: XMLRPC Port changes after restart ?!

Post by sotn0r » 16 Jun 2019, 13:09

Does the Maniaplanet server add +1 to the xmlrpc port if the default port in the config is blocked/not available/already used ?
yes, it does.
nc1.eu - TMF, TM² and ShootMania servers with first class support, control panel, FTP access and more..!

Image https://nc1.eu/
Image http://facebook.com/nc1.eu/
:arrow: https://twitter.com/nc1eu/

Nicklander
Posts: 29
Joined: 20 May 2018, 01:41

Re: XMLRPC Port changes after restart ?!

Post by Nicklander » 16 Jun 2019, 13:45

My cronjob in Debian looks like this:

# Stop TM2 Maniacontrol
1 6 * * * kill `pgrep -f ManiaControl_nickserver.php`
# Stop TM2 Server
2 6 * * * kill `pgrep -f nickserver`
# Start TM2 Server
5 6 * * * cd /path/to/nickserver; ./nickserver /game_settings=MatchSettings/tracklist.txt /dedicated_cfg=dedicated_cfg.txt
# Start TM2 Maniacontrol
7 6 * * * cd /path/to/nickserver/ManiaControl; php ManiaControl_nickserver.php >ManiaControl.log 2>&1 &

I wonder why it changes the port...
I mean all I do is shutting down the server and starting it up again...

User avatar
sotn0r
Posts: 87
Joined: 13 Mar 2011, 15:57
Contact:

Re: XMLRPC Port changes after restart ?!

Post by sotn0r » 16 Jun 2019, 14:06

Have you checked if your server is actually shut down once your cron starts it again? Your server logs should give you a hint at which times your server was shut down.

If you don't mind a non-graceful shutdown, you could add the -9 parameter to your kill command.
nc1.eu - TMF, TM² and ShootMania servers with first class support, control panel, FTP access and more..!

Image https://nc1.eu/
Image http://facebook.com/nc1.eu/
:arrow: https://twitter.com/nc1eu/

User avatar
TMarc
Posts: 15407
Joined: 05 Apr 2011, 19:10
Location: Europe
Contact:

Re: XMLRPC Port changes after restart ?!

Post by TMarc » 16 Jun 2019, 17:13

TCP/IP has a session shut down time of up to 2 minutes.
If you try to reuse the same port right after closing the server application, it is still blocked, hence a new port is used.

This means that you need to add a delay in your restart script.
Or you check which port is free and dynamically create a new config file with that port from a template with your usual setings.
maniaplanet forum global moderator

Link list with FAQ, Support, Wiki, Tutorials, Community activities, and much more.

System specs: Intel i7-970 12GB RAM, nVidia RTX 2060 6GB, Creative SB X-Fi, 2xSSD 1xHDD
Discord: TMarc#3002

Nicklander
Posts: 29
Joined: 20 May 2018, 01:41

Re: XMLRPC Port changes after restart ?!

Post by Nicklander » 16 Jun 2019, 17:20

TMarc wrote:
16 Jun 2019, 17:13
TCP/IP has a session shut down time of up to 2 minutes.
If you try to reuse the same port right after closing the server application, it is still blocked, hence a new port is used.

This means that you need to add a delay in your restart script.
Or you check which port is free and dynamically create a new config file with that port from a template with your usual setings.
Well if that is so then I will just add more delay in my cronjobs and maybe even kill everything twice (maybe also use pkill)

User avatar
TMarc
Posts: 15407
Joined: 05 Apr 2011, 19:10
Location: Europe
Contact:

Re: XMLRPC Port changes after restart ?!

Post by TMarc » 16 Jun 2019, 17:54

You can always check the port usage with
netstat -na
maniaplanet forum global moderator

Link list with FAQ, Support, Wiki, Tutorials, Community activities, and much more.

System specs: Intel i7-970 12GB RAM, nVidia RTX 2060 6GB, Creative SB X-Fi, 2xSSD 1xHDD
Discord: TMarc#3002

User avatar
undef.de
Posts: 2080
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: XMLRPC Port changes after restart ?!

Post by undef.de » 16 Jun 2019, 19:41

Anyway, in my eyes the dedicated server should not use a different port as the configured one, just stop if the configured port is not available as other daemons do too.

To pick an other port just bring problems, the controller can't connect or the port forwarding doesn't work on that port... (because the behavior for the Connection and P2P-ports are the same).
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.

User avatar
TMarc
Posts: 15407
Joined: 05 Apr 2011, 19:10
Location: Europe
Contact:

Re: XMLRPC Port changes after restart ?!

Post by TMarc » 16 Jun 2019, 21:36

absolutely right!
maniaplanet forum global moderator

Link list with FAQ, Support, Wiki, Tutorials, Community activities, and much more.

System specs: Intel i7-970 12GB RAM, nVidia RTX 2060 6GB, Creative SB X-Fi, 2xSSD 1xHDD
Discord: TMarc#3002

Nicklander
Posts: 29
Joined: 20 May 2018, 01:41

Re: XMLRPC Port changes after restart ?!

Post by Nicklander » 19 Jun 2019, 17:36

undef.de wrote:
16 Jun 2019, 19:41
Anyway, in my eyes the dedicated server should not use a different port as the configured one, just stop if the configured port is not available as other daemons do too.

To pick an other port just bring problems, the controller can't connect or the port forwarding doesn't work on that port... (because the behavior for the Connection and P2P-ports are the same).
I agree... the automatic port change is useless and just causes problems in the end.
If you start the server and the configured port isn't open, it should simply show an error message and shut the server down.

Post Reply

Return to “Dedicated Server”

Who is online

Users browsing this forum: No registered users and 1 guest