The International Simutrans Forum

Development => Bug Reports => Topic started by: Yona-TYT on March 26, 2026, 12:11:42 PM

Title: Another bug during the load of a scenario
Post by: Yona-TYT on March 26, 2026, 12:11:42 PM
I encountered this bug after repeatedly loading the same scenario; it seems to be related to multithreading.


(gdb) run
Starting program: /home/yona/Games/simutrans-nigth/simutrans
[Depuración de hilo usando libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Nuevo Thread 0x7fffe7abe6c0 (LWP 5283)]
[Nuevo Thread 0x7fffe72bd6c0 (LWP 5284)]
[Nuevo Thread 0x7fffe6abc6c0 (LWP 5293)]
[Nuevo Thread 0x7fffe62bb6c0 (LWP 5294)]
[Thread 0x7fffe62bb6c0 (LWP 5294) terminado]
[Thread 0x7fffe6abc6c0 (LWP 5293) terminado]
[Nuevo Thread 0x7fffe6abc6c0 (LWP 5295)]
[Nuevo Thread 0x7fffe62bb6c0 (LWP 5296)]
[Nuevo Thread 0x7fffd7fff6c0 (LWP 5309)]
[Nuevo Thread 0x7ffff27cf6c0 (LWP 5314)]
[Nuevo Thread 0x7fffd77fe6c0 (LWP 5319)]
[Nuevo Thread 0x7fffd6d636c0 (LWP 5326)]
[Nuevo Thread 0x7fffd65626c0 (LWP 5327)]
[Nuevo Thread 0x7fffd5d616c0 (LWP 5328)]
[Nuevo Thread 0x7fffd55606c0 (LWP 5330)]
[Nuevo Thread 0x7fffd4d5f6c0 (LWP 5331)]
[Nuevo Thread 0x7fffaffff6c0 (LWP 5332)]
[Nuevo Thread 0x7fffaf7fe6c0 (LWP 5333)]
[Nuevo Thread 0x7fffaeffd6c0 (LWP 5341)]
[Nuevo Thread 0x7fffae7fc6c0 (LWP 5347)]
[Nuevo Thread 0x7fffadffb6c0 (LWP 5348)]
[Nuevo Thread 0x7fffad7fa6c0 (LWP 5349)]
[Nuevo Thread 0x7fffacff96c0 (LWP 5350)]
[Nuevo Thread 0x7fff8834c6c0 (LWP 5352)]
[Nuevo Thread 0x7fff87b4b6c0 (LWP 5353)]
[Nuevo Thread 0x7fff8734a6c0 (LWP 5357)]
[Nuevo Thread 0x7fff86b496c0 (LWP 5362)]
[Nuevo Thread 0x7fff863486c0 (LWP 5363)]
[Nuevo Thread 0x7fff85b476c0 (LWP 5364)]
[Nuevo Thread 0x7fff853466c0 (LWP 5365)]
[Nuevo Thread 0x7fff84b456c0 (LWP 5367)]
[Nuevo Thread 0x7fff73fff6c0 (LWP 5368)]
[Nuevo Thread 0x7fff737fe6c0 (LWP 5369)]
[Nuevo Thread 0x7fff711786c0 (LWP 5377)]
[Nuevo Thread 0x7fff709776c0 (LWP 5378)]
[Nuevo Thread 0x7fff63fff6c0 (LWP 5379)]
[Nuevo Thread 0x7fff637fe6c0 (LWP 5381)]
[Nuevo Thread 0x7fff62ffd6c0 (LWP 5382)]
[Nuevo Thread 0x7fff627fc6c0 (LWP 5383)]
[Nuevo Thread 0x7fff61ffb6c0 (LWP 5384)]
[Thread 0x7fffe62bb6c0 (LWP 5296) terminado]
[Thread 0x7fffe6abc6c0 (LWP 5295) terminado]
[Nuevo Thread 0x7fffe6abc6c0 (LWP 5394)]
[Nuevo Thread 0x7fffe62bb6c0 (LWP 5395)]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 5408)]
[Thread 0x7fff6097d6c0 (LWP 5408) terminado]
[Nuevo Thread 0x7fff6097d6c0 (LWP 5913)]
[Thread 0x7fff6097d6c0 (LWP 5913) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 5926)]
[Thread 0x7fff6097d6c0 (LWP 5926) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 6005)]
[Thread 0x7fff6097d6c0 (LWP 6005) terminado]
[Nuevo Thread 0x7fff6097d6c0 (LWP 6107)]
[Thread 0x7fff6097d6c0 (LWP 6107) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 6122)]
[Thread 0x7fff6097d6c0 (LWP 6122) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 6214)]
[Thread 0x7fff6097d6c0 (LWP 6214) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 6268)]
[Thread 0x7fff6097d6c0 (LWP 6268) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 6683)]
[Thread 0x7fff6097d6c0 (LWP 6683) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 6707)]
[Thread 0x7fff6097d6c0 (LWP 6707) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 6764)]
[Thread 0x7fff6097d6c0 (LWP 6764) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 6868)]
[Thread 0x7fff6097d6c0 (LWP 6868) terminado]
script engine started.
[Nuevo Thread 0x7fff6097d6c0 (LWP 6935)]
[Nuevo Thread 0x7fff4bfff6c0 (LWP 6936)]
[Thread 0x7fff4bfff6c0 (LWP 6936) terminado]

Thread 54 "simutrans" received signal SIGSEGV, Segmentation fault.
[Cambiando a Thread 0x7fff6097d6c0 (LWP 6935)]
0x000055555567f326 in load_thread(void*) ()
(gdb) where
#0  0x000055555567f326 in load_thread(void*) ()
#1  0x00007ffff749caa4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
#2  0x00007ffff7529c6c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb)

Captura desde 2026-03-26 08-05-54.png
Title: Re: Another bug during the load of a scenario
Post by: prissi on March 26, 2026, 12:45:53 PM
Uncompressing while loading and the finishing after loading (recalculation of various positions etc.) is threaded. Simutrans otherwise is not apart from the display routines.

This error means the savegame is broken, i.e. an object on a tile is broken. There shoudl be a suitable error messge in the logfile for most of the errors, like illegal crossing (wrong savegame for a pak is such a candidate).
Title: Re: Another bug during the load of a scenario
Post by: ceeac on March 26, 2026, 12:57:37 PM
Does this still happen with r11912 or higher?
Title: Re: Another bug during the load of a scenario
Post by: Yona-TYT on March 26, 2026, 04:00:06 PM

We can rule that out since the savegame worked fine when I reopened Simutrans.

QuoteDoes this still happen with r11912 or higher?
It's hard to know since this bug doesn't happen so easily; I had loaded the scenario/savegame more than 10 times before it finally failed.
Title: Re: Another bug during the load of a scenario
Post by: prissi on March 27, 2026, 12:57:48 PM
Please turn on logging (-log 1 -debug 3) to see what exactly the game was doing. But from the loading bar, it looks like it did the map cleanup, the only part threaded.
Title: Re: Another bug during the load of a scenario
Post by: Yona-TYT on March 28, 2026, 02:40:43 AM
Quote from: prissi on March 27, 2026, 12:57:48 PMPlease turn on logging (-log 1 -debug 3) to see what exactly the game was doing.

For some reason, the .log file is not being created. "log_t::log_t: can't open file 'simu.log' for writing", I'm using PopOS Linux with a GNOME desktop.

Starting program: /home/yona/Games/simutrans-nigth/simutrans -log 1 -debug 3
[Depuración de hilo usando libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
log_t::log_t: can't open file 'simu.log' for writing
Simutrans version 124.4 Release Candidate from Mar 26 2026 r11911 hash 0x8af1ca1
Warning: loadsave_t::rd_open: File 'settings.xml' does not exist or is not accessible
Title: Re: Another bug during the load of a scenario
Post by: prissi on March 28, 2026, 12:13:54 PM
Then you gave that command from a non-writable folder??? But in this case, even saving should not work ...

If zou just use -debug 3 then it will print to sdterr (I think) or stdout.
Title: Re: Another bug during the load of a scenario
Post by: ceeac on March 29, 2026, 06:17:58 AM
Quote from: Yona-TYT on March 28, 2026, 02:40:43 AMFor some reason, the .log file is not being created.
Please update to r11913.