News:

Congratulations!
 You've won the News Item Lottery! Your prize? Reading this news item! :)

Simutrans hangs when run with "-singleuser" on Release builds

Started by Roboron, May 08, 2024, 05:07:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Roboron

This is a weird one. I usually compile Debug builds of Simutrans and use the "-singleuser" command line parameter to test them in an brand new directory.

Today I did the same, but this time with a Release build, and Simutrans freezes when I click on the pakset list. The same happens downloading the 124.0 release from sourceforge.

If there is only a pakset installed, the game loads it normally. If I run Simutrans from that directory without the "-singleuser" option, the game runs normally. If I run a Debug build with exactly the same parameters, the game runs normally.

If I am quick enough when choosing a pakset, Simutrans does not freeze! (Yeah, I am not joking, but I have to do it very quickly). The simu-log.txt attached if from a failed run and the simu.log.success.txt one is from a successful one where I was quick enough.

When it hangs, the last entry on the log is always:

Message: SDL_EVENT:     0x401
Sometimes it actually crashes and shows me this error, but it will usually happen after I have killed the previous attempt.

Fatal glibc error: tpp.c:83 (__pthread_tpp_change_priority): assertion failed: new_prio == -1 || (new_prio >= fifo_min_prio && new_prio <= fifo_max_prio)
Running on Arch Linux (Linux 6.8.9) with KDE Plasma 6.0.4

prissi

Recently, I noticed that sometimes that instead of the pak selector the pak installer was called. Maybe this is related. However, as soon as I set breakpoints, it never happened again. I will look at it. Furthermore, a release build crashes after pak selection, (May be related, the address sanitise does not like the pakselector, mismatched new/delete error ... ) But only for 32 bit builds?!?

ceeac

/media/ceeac/Projects/code/simutrans/src/simutrans/sys/simsys.cc:207:6: runtime error: index 18446744073709551615 out of bounds for type 'char[4096]'
    #0 0x5593c0de3bf9 in dr_mkdir(char const*) /media/ceeac/Projects/code/simutrans/src/simutrans/sys/simsys.cc:207:6
    #1 0x5593c02e61db in extract_pak_from_zip(char const*) /media/ceeac/Projects/code/simutrans/src/simutrans/dataobj/pakset_downloader.cc:168:5
    #2 0x5593c02e597a in pak_download(vector_tpl<paksetinfo_t*>) /media/ceeac/Projects/code/simutrans/src/simutrans/dataobj/pakset_downloader.cc:246:3
    #3 0x5593c07ff888 in pakinstaller_t::action_triggered(gui_action_creator_t*, value_t) /media/ceeac/Projects/code/simutrans/src/simutrans/gui/pakinstaller.cc:95:2
    #4 0x5593c07ffac9 in non-virtual thunk to pakinstaller_t::action_triggered(gui_action_creator_t*, value_t) /media/ceeac/Projects/code/simutrans/src/simutrans/gui/pakinstaller.cc
    #5 0x5593c04bfe4c in gui_action_creator_t::call_listeners(value_t) /media/ceeac/Projects/code/simutrans/src/simutrans/gui/components/gui_action_creator.h:32:11
    #6 0x5593c04c5132 in button_t::infowin_event(event_t const*) /media/ceeac/Projects/code/simutrans/src/simutrans/gui/components/gui_button.cc
    #7 0x5593c04e668d in gui_container_t::infowin_event(event_t const*) /media/ceeac/Projects/code/simutrans/src/simutrans/gui/components/gui_container.cc:205:23
    #8 0x5593c06d107f in gui_frame_t::infowin_event(event_t const*) /media/ceeac/Projects/code/simutrans/src/simutrans/gui/gui_frame.cc:134:34
    #9 0x5593c08b184a in check_pos_win(event_t*, bool) /media/ceeac/Projects/code/simutrans/src/simutrans/gui/simwin.cc:1712:20
    #10 0x5593c08bd66c in modal_dialogue(gui_frame_t*, long, karte_t*, bool (*)(), bool) /media/ceeac/Projects/code/simutrans/src/simutrans/gui/simwin.cc:2273:6
    #11 0x5593c0dd50ce in install_objfilename() /media/ceeac/Projects/code/simutrans/src/simutrans/simmain.cc:258:2
    #12 0x5593c0dced57 in simu_main(int, char**) /media/ceeac/Projects/code/simutrans/src/simutrans/simmain.cc:982:4
    #13 0x5593c0de59be in sysmain(int, char**) /media/ceeac/Projects/code/simutrans/src/simutrans/sys/simsys.cc:1441:9
    #14 0x7fd47d3a2d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0x7fd47d3a2e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0x5593c0071e24 in _start (/media/ceeac/Projects/code/simutrans/build/default/simutrans/simutrans+0xa20e24) (BuildId: e2ca6fd30eb65a2c5a666a627343c19338f3d7ce)

dr_mkdir is called with an empty string, so len-1 underflows. This also results in OOB access in the Windows version of dr_mkdir.

To reproduce, compile with ASAN+UBSAN with optimizations on, start simutrans in singleuser mode in a freshly downloaded installation, then try to install pak64.

prissi

I could not reproduce an empty dr_mkdir(), but I got another error. env_t::num_threads is 16 but the mutex in display is an array from 1..12!

Seems tonight is strange bug hunt.

Roboron