Bug uploading to dedimania

Python 3 Server Controller for Trackmania and Shootmania for script-only modes.

Moderators: TheM, toffe, NADEO

elie520
Posts: 95
Joined: 17 Feb 2017, 13:16

Bug uploading to dedimania

Post by elie520 »

Hello,

When I restart a map (using //res), sometimes, the connection to Dedimania fails. It happens about 30% of the time, and mostly when I've played the map for more than, say, 15 minutes. I usually only get a "Dedimania error", but this time I got this
Image

As you can imagine, it's pretty frustrating when you want to upload a score (you end up praying to the PyPlanet gods for the score to go through, and it's not always the case :( ). Any idea why this happens and how to correct it?
It kind of looks like if PyP was opening a connection with Dedimania at the beginning of the map, and that Dedimania closed it after a few minutes (which is normal bcs they have no buisiness keeping open connections for nothing). I don't know.

If you have any question, I'll try to answer.

Thanks for your help!
User avatar
Miss
Posts: 2151
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Bug uploading to dedimania

Post by Miss »

Not a PyPlanet dev or expert, but I do know that Dedimania is a terribly slow and unstable service in itself. When I was developing my own controller I've had countless issues like this, as well as dedimania just never responding to any request at all for long periods of time.

I think you should be praying to the Dedimania gods instead of the PyPlanet gods :P
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
elie520
Posts: 95
Joined: 17 Feb 2017, 13:16

Re: Bug uploading to dedimania

Post by elie520 »

Thanks for your answer!
Miss wrote: 04 Jul 2019, 16:51I think you should be praying to the Dedimania gods instead of the PyPlanet gods :P
I don't know, it's the first time I see this on a PyPlanet server, so I think I probably did something wrong in setting it up, that's why I'm asking for help :)
User avatar
Miss
Posts: 2151
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Bug uploading to dedimania

Post by Miss »

You probably set it up correctly if it times out only 30% of the time. It's just dedimania being dedimania, unfortunately. PyPlanet is already re-trying requests up to 5 times, so as you can see, it's not a great service.
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: Bug uploading to dedimania

Post by toffe »

I can confirm what Miss is telling. Some servers have servere trouble with connecting to Dedimania, while others don't have this at all. It seems like the location or route to the dedimania server might be badly from some other data center locations. The service itself is also slow and unreliable in general.
elie520
Posts: 95
Joined: 17 Feb 2017, 13:16

Re: Bug uploading to dedimania

Post by elie520 »

Hmmm, I can see this

Code: Select all

self.headers = {
			'User-Agent': 'PyPlanet/{}'.format(version),
			'Accept': 'text/xml',
			'Accept-Encoding': 'gzip',
			'Content-Type': 'text/xml; charset=UTF-8',
			'Content-Encoding': 'gzip',
			'Keep-Alive': 'timeout=600, max=2000',
			'Connection': 'Keep-Alive',
}
I'm not sure, but doesn't it mean that PyP is opening a connection with Dedimania at the start of the map, and trying to keep it open for the whole duration of the map? If the map is played for more than 2000 seconds, isn't the connection shut down, leading to an error?
If so, I'm not sure keeping an inactive connection for a long time is the way to go (in general in web programming I mean).

Again, thx for your answers.

Edit: Just saw your answer Toffe. Okok, this sucks :( But it's still weird as I never had that problem with uaseco when it was still alive.
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: Bug uploading to dedimania

Post by toffe »

I completely agree with you that keeping a long connection open is not generally a good thing to do as HTTP is stateless and should work any time. However the developers of Dedimania are forcing you to keep the connection open to lower the load on their side. (source: http://dedimania.net:8082/Dedimania)
elie520
Posts: 95
Joined: 17 Feb 2017, 13:16

Re: Bug uploading to dedimania

Post by elie520 »

Indeed. I don't quite understand how this is suppose to be better for their servers. Especially if there a thousands of open connections. Anyway, I tried once more waiting for about 30 minutes, and after //res, same error. I think Dedimania is trying to close the connection as soon as it can (after the timeout if idle). Don't you think sending an empty request every, say, 300 seconds, would solve the problem?? I'm curious about that.

Edit: Tried again with 11 minutes on the map, same error.
User avatar
toffe
Posts: 782
Joined: 15 Jun 2013, 10:57
Location: The Netherlands
Contact:

Re: Bug uploading to dedimania

Post by toffe »

Well, the traffic to dedimania is huge, and therefor, keeping a connection open might be better than opening on every request. Keep in mind that the service is free of charge and relies on donations (which they don't get so much).

The Keep-Alive mechanism keeps the connection alive by sending small packages every x time if I'm correct. We might need to increase the keep-alive time. PyPlanet should reconnect if the connection is failed tho, and it seems that either this doesn't work or even reconnecting has no result.
elie520
Posts: 95
Joined: 17 Feb 2017, 13:16

Re: Bug uploading to dedimania

Post by elie520 »

I'm not sure the client needs to send anything to keep the connection alive after the server agrees to keep it alive. Sending frequent request could artificially keep the connection non idle, but as you mentionned, one could also increase the timeout. This is a bad idea imo, because if the client suddenly disappears without properly closing the connection, Dedimania wouldn't be notified, and thus would keep an idle connection alive for a long time, for nothing.
I'm not sure how TCP works anymore, but after the timeout, if Dedimania closes the connection on its own without telling PyP first, PyP might never know? Thus, PyPlanet doesn't see any "failed connection", and so won't reconnect.

In the end, I think the better idea would be to set timeout to a few minutes (10 minutes is fine as it's already done), and making sure the connection isn't idle every 5 minutes.
Post Reply

Return to “PyPlanet”

Who is online

Users browsing this forum: No registered users and 2 guests