Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Upload Multiplayer Game #12997

Open
1 task done
MaikelFritz opened this issue Feb 24, 2025 · 36 comments
Open
1 task done

Unable to Upload Multiplayer Game #12997

MaikelFritz opened this issue Feb 24, 2025 · 36 comments
Labels

Comments

@MaikelFritz
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Game Version

4,15.12

Describe the bug

Unable to upload game in Multiplayer Mode
Error Popup occurs.. No way to end a round.

Steps to Reproduce

  1. Go to Next Round

Screenshots

No response

Link to save file

No response

Operating System

Android

Additional Information

No response

@Green-Sky
Copy link

@touhidurrr sorry for tag, but this has pretty much deadlocked a game for me for 2 days now.

@Vanadium-GITHUB
Copy link

I am also having this issue myself. ^^^

@touhidurrr
Copy link
Contributor

@Green-Sky @Vanadium-GITHUB cannot reproduce the issue.

@Green-Sky
Copy link

Green-Sky commented Feb 26, 2025

Right, for me the notification(?) state is a different turn the the actual savegame. So you are looking for games that have inconsistent "next turn" state.

Also, sometimes it appears it does upload the game, despite saying it failed.

@Vanadium-GITHUB
Copy link

Vanadium-GITHUB commented Feb 27, 2025

Windows game.

Unsure if this will help but here is my save game.

https://github.com/[Vanadium-GITHUB/unciv-save-game](https://github.com/Vanadium-GITHUB/unciv-save-game)

Image

I considered if it was an issue with mods, but OP is receiving the same error playing without mods.

One thing I am unsure matters, but on my screen it says the current turn is the other player (korea) from 3 days ago, but its clearly my turn, after they did their turn this morning.

Image

@touhidurrr
Copy link
Contributor

By the way, the server has a filesize limit. Are you sure you guys did not exceed it?

@Vanadium-GITHUB
Copy link

@touhidurrr that must be it. What is the limit?

@yairm210
Copy link
Owner

Oh dear
What size games are y'all playing?

@Vanadium-GITHUB
Copy link

@yairm210 Our save was 1.28 MB

@touhidurrr
Copy link
Contributor

The server file size limit is 1MB. I am planning to increase this to 2MB next month following the automatic system upgrade to MongoDB Flex. MongoDB Atlas seems to be moving to a new pricing structure and our instance will be automatically migrated to Flex with a 150% increase in storage without any noticeable increase in cost.
I think I will increase the file size limit at that time because bigger games seems to be gaining some weird popularity recently and with an average file size of <100KB, this should not affect the server much.

@touhidurrr
Copy link
Contributor

@yairm210 Our save was 1.28 MB

Save or JSON?

@touhidurrr
Copy link
Contributor

Also, do you guys use discord? Can you run a /gameinfo command on your game and show us the output?

@Green-Sky
Copy link

Green-Sky commented Feb 27, 2025

Also, do you guys use discord? Can you run a /gameinfo command on your game and show us the output?

No, but I asked a friend, and the command just times out (pm).

Our json(?) is 2.2mib.

@touhidurrr
Copy link
Contributor

touhidurrr commented Feb 27, 2025

@yairm210 Our save was 1.28 MB

Our json(?) is 2.2mib.

The server only care about save size not json size, since saves are what gets uploaded. But if your save is 1.28 MB, I expected the json size to be something like 10MB or more. So, it being 2.2MB is sus. Anyways, regardless, this is not a server issue. As i said before, the file size limit is 1MB. So, it is normal for a 1.28MB save to be rejected. I just asked to be sure.

@Green-Sky
Copy link

What is a savefile. I said json, because the autosave file contains json.

@touhidurrr
Copy link
Contributor

Ok, I guess I will just increase the limit to 2MB now, since march is near anyways. And its not like we are currently in any low disk space situation.

Image

Done with touhidurrr/UncivServer.xyz@58b8c3b

@touhidurrr
Copy link
Contributor

@Green-Sky @Vanadium-GITHUB let me know if this fixes your issues.

@Hoernla
Copy link

Hoernla commented Feb 28, 2025

I haven't written before, but have watched this thread from the start, experiencing the exactly same problems. In our game, the road is still bumpy. That means, when I finish my turn, it seems not to work, upload is not confirmed, the next player is not shown in the main screen as "waiting for".
At some point in time, this might switch. Until then, however, reloading the game allows me (forces me?) to make this turn once more.

All the while, when I go to the "Multiplayer" menu, there is still another player's turn from a week ago shown as current. When I want to pass this turn, a message comes telling me I cannot pass him as the current player has been updated. However, sometimes it shows the actual current player but will jump back.

@touhidurrr
Copy link
Contributor

@yairm210, the more I read these issues the more I feel like it is something related to Preview files. WE NEED WEBSOCKETS (100).

Anyways, cannot still reproduce any of it.

@Green-Sky
Copy link

Issue persists, no change. @Hoernla did describe it nicely.

@touhidurrr
Copy link
Contributor

touhidurrr commented Feb 28, 2025

Unsure if this will help but here is my save game.

[https://github.com/Vanadium-GITHUB/unciv-save-game](https://github.com/%5BVanadium-GITHUB/unciv-save-game%5D(https://github.com/Vanadium-GITHUB/unciv-save-game))

I dont know where issues like this are popping up from but I just entered this game and made a turn as Korea without any problem. So, yet again, cannot reproduce any issue.

@touhidurrr
Copy link
Contributor

touhidurrr commented Feb 28, 2025

At some point in time, this might switch. Until then, however, reloading the game allows me (forces me?) to make this turn once more.

Looks like a client issue to me @yairm210 . @Hoernla, can you share you save also?

@touhidurrr
Copy link
Contributor

touhidurrr commented Feb 28, 2025

Also, one thing for sure that you guys are not updating your clients often. Which can also lead to weird issues. @Vanadium-GITHUB.

Image

The latest version for example:

Image

That is 139 versions behind latest. That makes me wonder, even if these issues do exist and are fixed in a future version, will you guys ever update your clients to enjoy the fix to begin with. Sigh.

@Vanadium-GITHUB
Copy link

Thank you, I will do that

@Hoernla
Copy link

Hoernla commented Feb 28, 2025

I added a txt to upload.
Now we know that we infrequently update (at least those on windows, half of us use android), however we all updated as soon as we ran into this problem.

autosave.txt

@touhidurrr
Copy link
Contributor

touhidurrr commented Feb 28, 2025

however we all updated as soon as we ran into this problem.

Does this mean you guys are all still facing the problem even after updating? That being said, what is the issue exactly? I tried playing your game and made a turn in it successfully without any issue. Have you guys noticed this?

Also, where do you guys live? Can it be that the issue happens in your region only.

@Vanadium-GITHUB
Copy link

Vanadium-GITHUB commented Mar 1, 2025

@touhidurrr @yairm210 Updating to current client works! Thank you for the help and sorry for the trouble. =)

Edit, after 5 turns it stopped working again

@Green-Sky
Copy link

Also, where do you guys live? Can it be that the issue happens in your region only.

Central Europa.

Now we know that we infrequently update (at least those on windows, half of us use android), however we all updated as soon as we ran into this problem.

Similar too us. Really funny how the problem suddenly popped up for a wide range of versions.

I still think it's weird that it sometimes works, despite the "upload failed" error. But the update status(preview file?) has not been updated in 7 days.

@MaikelFritz
Copy link
Author

Hey - thank you very much for your quick help. I wasnt able to respond during the week due to heavy workload.
The problem however still persists. I cant end my turn. I am located in Germany and all players are using android systems.
Ive checked my version - I am using the current version 4.15.13
game-id is f0fd7e28-b472-419e-bc85-3c62f78309c4

would it be safe to start a smaller game or could it occur there as well.
thanks for your help and your good work on this game! appreciate it very much!

@Hoernla
Copy link

Hoernla commented Mar 2, 2025

Germany as well. As I said we updated as soon as we ran into the issue to 4.15.12

Game-IDs are:
d5890572-b7bb-4ad0-858e-8bc276481c90
b92cdb39-6003-42fc-841c-5e8729cee386

We are on https://uncivserver.xyz

@touhidurrr
Copy link
Contributor

touhidurrr commented Mar 2, 2025

Ok, @yairm210, I can finally reproduce the issue a bit and can guess why this is happening. Look as the screenshot below:

Image

Ignore the debug log in the last line. It just shows first 100 characters of the save and true means the game file was not corrupted (can be unpacked). but what is noticeable here is not the presence of something but the absence of something. The client here is uploading the game file properly but never trying to upload the Preview file. Which is weird. This leaves the preview file to be always outdated. And yes, this can be reproduced. (try with gameId d5890572-b7bb-4ad0-858e-8bc276481c90) So, now we have 2 reasons why this might be happening:

  1. uploading Preview files is failing for some reason. (server issue)
  2. the client cannot upload the preview file for some reason, (client issue)

For reference, this is how a normal behavior should look like:

Image

I am looking into possibility 1 for now.

@touhidurrr
Copy link
Contributor

touhidurrr commented Mar 2, 2025

Ok, after much testing, I have come into the conclusion that it is probably a client issue. Maybe in certain situations Preview files generation fails. As, from what I can see from logs, an attempt to upload the file was never made to begin with. Let me know, what the issue was when you are able to figure it out @yairm210 .

@touhidurrr
Copy link
Contributor

touhidurrr commented Mar 2, 2025

Ok, it took me a packet-capturing software to figure out what was going on. However, the problem seems to be some faulty validation issue. This was the fix:

Image

Here, 'byte' is supposed to mean 'base64', and it worked as far as I know. But for some reason, for certain uploads, this validation seems not to work and the response results in a validation error. This kind of validation was there to prevent corrupted game files to uploaded to the server, but it broke and I am not sure why. Thankfully we do not need this now because we now check if the save file is a proper JSON-gzipped-base64 file somewhere else in the codebase. So, we do not need to check it here also. The cause might be this validation being broken in the library I am using for some reason. But then again, why does this issue happen so rarely? And for some games it happens and for some other games not. Sigh.

Anyway, the issue should be fixed now. But it is also true that if the error messages were a little more helpful, maybe I would not have required WireShark to debug it. Why do I need to use my cybersec knowledge to debug a silly issue? Sigh.

@Green-Sky @Vanadium-GITHUB @Hoernla kindly check and report if the issue still persists. @redfufu also from #12998.

@yairm210
Copy link
Owner

yairm210 commented Mar 2, 2025

Wow, excellent hunting!
I wonder if I can add client side validation that indeed the preview and actual save are equivalent, in i.e. turn number... 🤔

@touhidurrr
Copy link
Contributor

touhidurrr commented Mar 2, 2025

I wonder if I can add client side validation that indeed the preview and actual save are equivalent, in i.e. turn number... 🤔

Not sure what that will solve. In the end I found out that the client was not indeed working properly. So, changing its behaviour might result in unforeseen circumstances. Maybe we should fetch the full game file once in a while also. Like one in 20 refresh probably? But that feels useless also.

Just bring on the WebSocket standard I proposed before to solve problems like this.

@touhidurrr
Copy link
Contributor

I guess you misunderstood why this happened. For some rare cases, for unknown reasons, the base64 validation failed. So, even when I manually tried to hit the api with made up requests everything was ok. And I needed installed WireShark to verify my doubts.

Preview files were not the issue. The uploading of the main save files were failing in a way I was unable to figure out how. And that's why the client never attempted to upload preview files. So, in the end, the issue was very random and did not happen consistently enough for me to reproduce it. Not an issue with the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants