widelands / wl_addons_server

Provides the add-ons server and all add-ons for the Widelands game.
https://www.widelands.org
Other
6 stars 4 forks source link

No ingame upload possible with error message #156

Open MarkMcWire opened 4 months ago

MarkMcWire commented 4 months ago

Since two weeks I cannot upload my Europeans tribe addon. There is always an error. See screenshot.

Bildschirmfoto vom 2024-04-19 17-48-08

If I want to update the food addon, the upload works, but a similar error message appears afterwards.

Upload of my map addon or the debug script addon works fine.

bunnybot commented 4 months ago

Mirrored on Codeberg as #CB87.

bunnybot commented 4 months ago

Assigned to Nordfriese

MarkMcWire commented 4 months ago

Nope:

[00:00:25.656 real] ERROR: upload addon europeans_tribe.wad: Expected a int, received:

bunnybot commented 4 months ago

NordfrieseMirrored from Codeberg On Wed Apr 24 10:15:37 CEST 2024, Benedikt Straub (Nordfriese) wrote:


Did you check out and compile the branch https://github.com/widelands/widelands/tree/mirror/Nordfriese/widelands/87-addon-upload-error ? (The bug is in Widelands, not in the server)

MarkMcWire commented 4 months ago

I am unable to compile this branch. Tried in a virtual machine with Ubuntu and with LinuxMint. All dependencies are installed. I will try it with Fedora and OpenSuse in the next days.

The SegFault error occurs in every OS on another position.

MarkMcWire commented 3 months ago

It must be a server problem. I just tried to overwrite the addon "europeans_tribe.wad" on the server with an empty addon (only containing the addon file) and I got the same error message. So it can't be because the amount of data is too large or the transfer is leaking or something like that.

The server is sending some signal or data that the game cannot process correctly.

Have you ever checked the hash algorithm that compares local and server data?

bunnybot commented 3 months ago

NordfrieseMirrored from Codeberg On Thu May 30 11:44:28 CEST 2024, Benedikt Straub (Nordfriese) wrote:


The server log simply says this:

[Wed May 29 19:45:16 CEST 2024 @ Client<#>2961] Received command: 2:CMD_SUBMIT europeans_tribe.wad
[Wed May 29 19:45:28 CEST 2024 @ Client<#>2961] ERROR: WL Protocol Exception: Stream ended unexpectedly while reading file
WL Protocol Exception: Stream ended unexpectedly while reading file
        at wl.server.HandleCommand.doHandleCmdSubmit_New(HandleCommand.java:1271)
        at wl.server.HandleCommand.lambda$handleCmdSubmit$7(HandleCommand.java:920)
        at wl.server.ServerUtils.doSemaphore(ServerUtils.java:116)
        at wl.server.ServerUtils.semaphoreRW(ServerUtils.java:109)
        at wl.server.HandleCommand.handleCmdSubmit(HandleCommand.java:898)
        at wl.server.HandleCommand.handle(HandleCommand.java:152)
        at wl.server.ClientThread.run(ClientThread.java:128)
        at java.base/java.lang.Thread.run(Thread.java:833)
[Wed May 29 19:45:28 CEST 2024 @ Client<#>2961] Connection quit.

The hashing algorithm is fine (tested a lot when first implementing it), so it must be a problem locally in the Widelands client. It might be related to the new timeouts, maybe try editing src/net_addons.cc and comment out the setsockopt calls in lines 202 204 210 212 and try if this changes anything. If not, please again post the complete log output of Widelands (run with --verbose!).

diff --git a/src/network/net_addons.cc b/src/network/net_addons.cc
index f62bcc7868..3b575384dc 100644
--- a/src/network/net_addons.cc
+++ b/src/network/net_addons.cc
@@ -199,17 +199,17 @@ void NetAddons::init(std::string username, std::string password) {
    DWORD timeout_val = kTimeout * 1000;
    const char* timeout_ptr = reinterpret_cast<const char*>(&timeout_val);
    // Set timeout of read()
-   setsockopt(client_socket_, SOL_SOCKET, SO_RCVTIMEO, timeout_ptr, sizeof(timeout_val));
+   // setsockopt(client_socket_, SOL_SOCKET, SO_RCVTIMEO, timeout_ptr, sizeof(timeout_val));
    // Set timeout of write()
-   setsockopt(client_socket_, SOL_SOCKET, SO_SNDTIMEO, timeout_ptr, sizeof(timeout_val));
+   // setsockopt(client_socket_, SOL_SOCKET, SO_SNDTIMEO, timeout_ptr, sizeof(timeout_val));
 #else
    struct timeval timeout_val;
    timeout_val.tv_sec = kTimeout;
    timeout_val.tv_usec = 0;
    // Set timeout of read()
-   setsockopt(client_socket_, SOL_SOCKET, SO_RCVTIMEO, &timeout_val, sizeof(timeout_val));
+   // setsockopt(client_socket_, SOL_SOCKET, SO_RCVTIMEO, &timeout_val, sizeof(timeout_val));
    // Set timeout of write()
-   setsockopt(client_socket_, SOL_SOCKET, SO_SNDTIMEO, &timeout_val, sizeof(timeout_val));
+   // setsockopt(client_socket_, SOL_SOCKET, SO_SNDTIMEO, &timeout_val, sizeof(timeout_val));
 #endif

    const std::string target_ip = get_config_string("addon_server_ip", "widelands.org");
MarkMcWire commented 3 months ago

That fixed the problem.

bunnybot commented 3 months ago

NordfrieseMirrored from Codeberg On Sat Jun 01 10:17:02 CEST 2024, Benedikt Straub (Nordfriese) wrote:


Ok, I have added a commit to the linked Widelands branch that suppresses the timeouts just for selected operations including uploading an add-on. The next time you update the europeans add-ons suite can you please try again with the latest commit to verify that the fix still works in that form? (We can't simply apply the above patch to master, the timeouts were added to fix a different bug…)

MarkMcWire commented 2 months ago

Setting constexpr uint32_t kTimeout = 16; solved the problem, even without comment out these lines.