crash - String too long for serializeString

Post Reply
loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

crash - String too long for serializeString

by loosewheel » Post

Game was hosted over LAN.

Crash occurred when the item was dropped (Q key).

When dropped in host machine:

Code: Select all

2021-02-22 13:48:44: ACTION[Server]: loosewheel uses lwcomputers:book, pointing at [nothing]
2021-02-22 13:48:50: ERROR[Server]: An unhandled exception occurred: String too long for serializeString
2021-02-22 13:48:50: ERROR[Server]: In thread 7f11597d7700:
2021-02-22 13:48:50: ERROR[Server]: /build/minetest-2HALFv/minetest-5.3.0/src/server.cpp:7d: virtual void* ServerThread::run(): A fatal error occurred: String too long for serializeString
When dropped in client machine, which crashes the host:

Code: Select all

2021-02-22 13:38:31: ACTION[Server]: mary uses lwcomputers:book, pointing at [nothing]
2021-02-22 13:38:31: WARNING[ConnectionSend]: con(18/1) Packet quota used up for peer_id=3, was 512 pkts
2021-02-22 13:38:32: WARNING[ConnectionSend]: con(18/1) Packet quota used up for peer_id=3, was 512 pkts
2021-02-22 13:38:32: WARNING[ConnectionSend]: con(18/1) Packet quota used up for peer_id=3, was 512 pkts
2021-02-22 13:38:34: WARNING[ConnectionSend]: con(18/1) Packet quota used up for peer_id=3, was 512 pkts
2021-02-22 13:38:39: ERROR[Server]: An unhandled exception occurred: String too long for serializeString
2021-02-22 13:38:39: ERROR[Server]: In thread 7fc4773ee700:
2021-02-22 13:38:39: ERROR[Server]: /build/minetest-2HALFv/minetest-5.3.0/src/server.cpp:7d: virtual void* ServerThread::run(): A fatal error occurred: String too long for serializeString
The item contains a lengthy string in its meta data.

Is there a work around/fix/setting for this, or is this a hard limit? What is the limit (how big is 512 pkts)?

User avatar
AiTechEye
Member
Posts: 1000
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: Sweden

Re: crash - String too long for serializeString

by AiTechEye » Post

i think its a hard limit, about 65000 characters, i also got this trouble, my workaround was to replace patterns to make the string shorter, eg if the string contains lots of ".png" you could repalce it with "!" then reverse when the string is used.

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: crash - String too long for serializeString

by Krock » Post

https://github.com/minetest/minetest/issues/10981

Please run your game in "gdb" (Linux) or "windbg" (Windows) and reproduce the crash. Alternatively upload a world to properly reproduce it.

PS: You can ignore the "Packet quota used up" messages as long no players disconnect at random.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: crash - String too long for serializeString

by loosewheel » Post

@AiTechEye, I byte encoded the book data instead of using a serialised table. I can get a max of 5 pages. I seem to be able to put about 12kb in the metadata before this error occurs. The items that have disk space are way to big to reduce. I store the disk data in a file from the on_drop handler, and overrode the minetest.registered_entities["__builtin:item"].on_punch handler to put it back in the item when the item is picked up. This seems to work, but I think I’ll simplify the mechanism to use it with other items too.

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: crash - String too long for serializeString

by loosewheel » Post

@Krock here is the output from gdb: GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from minetest...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/minetest
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff7fa5700 (LWP 29050)]
[Thread 0x7ffff7fa5700 (LWP 29050) exited]
[New Thread 0x7fffe3fff700 (LWP 29051)]
[Thread 0x7fffe3fff700 (LWP 29051) exited]
[New Thread 0x7fffe3fff700 (LWP 29052)]
[New Thread 0x7fffe8563700 (LWP 29053)]
[New Thread 0x7fffd298e700 (LWP 29054)]
[New Thread 0x7fffd218d700 (LWP 29055)]
[New Thread 0x7fffd198c700 (LWP 29056)]
[New Thread 0x7fffd118b700 (LWP 29057)]
Loaded texture: /usr/share/minetest/games/minetest_game/menu/header.png
Loaded texture: /usr/share/minetest/games/devtest/menu/icon.png
Loaded texture: /usr/share/minetest/games/minetest_game/menu/icon.png
Loaded texture: /usr/share/minetest/textures/base/pack/plus.png
[Thread 0x7fffd118b700 (LWP 29057) exited]
[Thread 0x7fffd198c700 (LWP 29056) exited]
[Thread 0x7fffd218d700 (LWP 29055) exited]
[Thread 0x7fffd298e700 (LWP 29054) exited]
[New Thread 0x7fffd118b700 (LWP 29058)]
[New Thread 0x7fffd198c700 (LWP 29059)]
2021-02-23 13:26:43: WARNING[Main]: Mod name conflict detected: "farming"
2021-02-23 13:26:43: WARNING[Main]: Will not load: /usr/share/minetest/games/minetest_game/mods/farming
2021-02-23 13:26:43: WARNING[Main]: Overridden by: /home/paul/.minetest/mods/dreambuilder_modpack/farming
2021-02-23 13:26:43: ERROR[Main]: mod "unifieddyes" has unsatisfied dependencies: "basic_materials"
2021-02-23 13:26:43: ERROR[Main]: mod "unifiedmesecons" has unsatisfied dependencies: "unifieddyes"
[OK] Mesecons
2021-02-23 13:26:43: WARNING[Main]: Undeclared global variable "corner_nodebox" accessed at ...mods/dreambuilder_modpack/mesecons_extrawires/corner.lua:33
2021-02-23 13:26:43: WARNING[Main]: Undeclared global variable "corner_nodebox" accessed at ...mods/dreambuilder_modpack/mesecons_extrawires/corner.lua:61
2021-02-23 13:26:43: WARNING[Main]: digistuff is not allowed to use the HTTP API - digilines NIC will not be available!
2021-02-23 13:26:43: WARNING[Main]: If this functionality is desired, please add digistuff to your secure.http_mods setting
(T@bonemeal)[MOD] bonemeal loaded

[New Thread 0x7fffd218d700 (LWP 29060)]
.__ __ __
_____ |__| ____ _____/ |_ ____ _______/ |_
/ \| |/ \_/ __ \ __\/ __ \ / ___/\ __\
| Y Y \ | | \ ___/| | \ ___/ \___ \ | |
|__|_| /__|___| /\___ >__| \___ >____ > |__|
\/ \/ \/ \/ \/
2021-02-23 13:26:44: ACTION[Main]: World at [/home/paul/.minetest/worlds/meta]
2021-02-23 13:26:44: ACTION[Main]: Server for gameid="minetest" listening on 0.0.0.0:52283.
[New Thread 0x7fffd298e700 (LWP 29061)]
[New Thread 0x7fffd098a700 (LWP 29062)]
[New Thread 0x7fffbac86700 (LWP 29063)]
Unified Inventory. inventory size: 658
2021-02-23 13:26:45: WARNING[Main]: Irrlicht: PNG warning: Interlace handling should be turned on when using png_read_image
2021-02-23 13:26:45: WARNING[Main]: Irrlicht: PNG warning: Interlace handling should be turned on when using png_read_image
2021-02-23 13:26:46: WARNING[Main]: Irrlicht: PNG warning: Interlace handling should be turned on when using png_read_image
2021-02-23 13:26:47: WARNING[Main]: Irrlicht: PNG warning: Interlace handling should be turned on when using png_read_image
2021-02-23 13:26:47: WARNING[Main]: Irrlicht: PNG warning: Interlace handling should be turned on when using png_read_image
[New Thread 0x7fffb930c700 (LWP 29064)]
2021-02-23 13:26:50: ACTION[Server]: singleplayer [127.0.0.1] joins game. List of players: singleplayer
2021-02-23 13:26:50: WARNING[ConnectionSend]: con(18/1) Packet quota used up for peer_id=2, was 1024 pkts
[New Thread 0x7fffb8b0b700 (LWP 29065)]
2021-02-23 13:26:53: ERROR[Server]: An unhandled exception occurred: String too long for serializeString
2021-02-23 13:26:53: ERROR[Server]: In thread 7fffd218d700:
2021-02-23 13:26:53: ERROR[Server]: /build/minetest-2HALFv/minetest-5.3.0/src/server.cpp:7d: virtual void* ServerThread::run(): A fatal error occurred: String too long for serializeString

Thread 12 "Server" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffd218d700 (LWP 29060)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff4971921 in __GI_abort () at abort.c:79
#2 0x0000555555b4d267 in fatal_error_fn(char const*, char const*, unsigned int, char const*) ()
#3 0x0000555555c460de in ServerThread::run() ()
#4 0x0000555555a5e4e3 in Thread::threadProc(Thread*) ()
#5 0x00007ffff53956df in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff62436db in start_thread (arg=0x7fffd218d700) at pthread_create.c:463
#7 0x00007ffff4a5271f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) s
Couldn't get registers: No such process.
Couldn't get registers: No such process.
(gdb) q
A debugging session is active.

Inferior 1 [process 29046] will be killed.

Quit anyway? (y or n) y
[Thread 0x7fffd218d700 (LWP 29060) exited]
Couldn't get registers: No such process. I think the offender is here, file server.c, line 93. Line 7d (125) is the END_DEBUG_EXCEPTION_HANDLER macro.

Code: Select all

void *ServerThread::run()
{
	BEGIN_DEBUG_EXCEPTION_HANDLER

	/*
	 * The real business of the server happens on the ServerThread.
	 * How this works:
	 * AsyncRunStep() runs an actual server step as soon as enough time has
	 * passed (dedicated_server_loop keeps track of that).
	 * Receive() blocks at least(!) 30ms waiting for a packet (so this loop
	 * doesn't busy wait) and will process any remaining packets.
	 */

	m_server->AsyncRunStep(true);

	while (!stopRequested()) {
		try {
			m_server->AsyncRunStep();

			m_server->Receive();

		} catch (con::PeerNotFoundException &e) {
			infostream<<"Server: PeerNotFoundException"<<std::endl;
		} catch (ClientNotFoundException &e) {
		} catch (con::ConnectionBindFailed &e) {
			m_server->setAsyncFatalError(e.what());
		} catch (LuaError &e) {
			m_server->setAsyncFatalError(
					"ServerThread::run Lua: " + std::string(e.what()));
		}
	}

	END_DEBUG_EXCEPTION_HANDLER

	return nullptr;
}
It appears that when an item is dropped the item is converted to a string and sent to the server. When the string is larger than a certain size this causes the exception. The minetest.registered_entities["__builtin:item"].on_punch deals with the item as a string, including its metadata.

User avatar
hex
Member
Posts: 82
Joined: Sun Dec 06, 2020 04:22
IRC: hecks
In-game: hex hhhehehe

Re: crash - String too long for serializeString

by hex » Post

Never mind that a client has no business sending meta in the first place, but does the server just blindly believe whatever the client stuffs in there? How does this work?

sfan5
Moderator
Posts: 4094
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

Re: crash - String too long for serializeString

by sfan5 » Post

This isn't the client sending meta, it's the server encountering an error upon trying to send more than 64k characters from somewhere in the in-game environment. Mods should take care not to store huge amounts of data inside item metadata.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests