News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

[r7802] saving game does not finish

Started by captain crunch, July 13, 2016, 12:59:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

captain crunch

Since r7802 saving a game does not complete. The progress meter halts just before the end.
Funnily, when starting the game in gdb saving the game completes. This trick does not work when gdb is attached to the process after it is already running.
See attached files for configuration variables and a gdb backtrace from when saving does not complete.
Edit: Missed some lines in config.default.

Dwachs

Cannot download these attachments (404 - Attachment Not Found) Can you copy the text into the forum message?
Parsley, sage, rosemary, and maggikraut.

Ters

At least on Windows, some system calls function differently when they detect that the process are being debugged. They check for this when the process starts up. Other OSes might do something similar. This might explain why things behave differently when the process is launched from GDB. In my experience, the difference that makes the difference, is that the debug version of the memory allocator will usually initialize the memory to some known value. This might be zero, or it might be 0xbaadfood. The former is most likely to obscure reads from uninitialized memory.

captain crunch


---config.default---
BACKEND = mixer_sdl
COLOUR_DEPTH = 16
OSTYPE = linux
DEBUG = 1    # Level 1-3, higher number means more debug-friendly, see Makefile
OPTIMISE = 1 # Add umpteen optimisation flags
MULTI_THREAD = 4 # start this many threads for some tasks like updating, map rotation, ...
PNG_CONFIG     = pkg-config libpng
SDL_CONFIG     = sdl-config
VERBOSE = 1
DEBUG_ROUTES = 0
FLAGS = -DAUTOMATIC_BRIDGES -DAUTOMATIC_TUNNELS
FLAGS += -DREVISION=$(shell git log -n 10 | egrep -o "trunk@([0-9]+)"|cut -d@ -f2|head -n 1)
BUILDDIR = $(shell pwd)/build/default
PROGDIR  = $(shell echo $$HOME/simutrans)
CXX=g++


---gdb_backtrace---
Attaching to program: simutrans/sim, process 12425
pthread_barrier_wait ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S:71
71 ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: No such file or directory.
#0  pthread_barrier_wait ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S:71
#1  0x0000000000465b43 in loadsave_t::set_buffered (
    this=this@entry=0x7fffffffbbc0, enable=enable@entry=false)
    at dataobj/loadsave.cc:159
#2  0x00000000006c208d in karte_t::save (this=this@entry=0x11a6480,
    file=file@entry=0x7fffffffbbc0, silent=silent@entry=false)
    at simworld.cc:4798
#3  0x00000000006c2502 in karte_t::save (this=0x11a6480,
    filename=0x7fffffffbca0 "save/kaputt.sve", savemode=loadsave_t::bzip2,
    version_str=0x705620 "0.120.1", silent=silent@entry=false)
    at simworld.cc:4559
#4  0x00000000005246df in item_action (filename=<optimized out>,
    this=<optimized out>) at gui/loadsave_frame.cc:68
#5  loadsave_frame_t::ok_action (this=<optimized out>,
    filename=<optimized out>) at gui/loadsave_frame.cc:80
#6  0x00000000005367d4 in savegame_frame_t::action_triggered (this=0x2245980,
    component=<optimized out>) at gui/savegame_frame.cc:503
#7  0x00000000004c32d2 in call_listeners (v=..., this=0x22462c8)
    at gui/components/gui_action_creator.h:36
#8  button_t::infowin_event (this=0x22462b0, ev=0x7fffffffc130)
    at gui/components/gui_button.cc:234
#9  0x00000000004c7895 in gui_container_t::infowin_event (
    this=this@entry=0x2245988, ev=ev@entry=0x7fffffffc1a0)
    at gui/components/gui_container.cc:198
#10 0x0000000000500e4a in gui_frame_t::infowin_event (this=0x2245980,
    ev=<optimized out>) at gui/gui_frame.cc:98
#11 0x000000000055c58c in check_pos_win (ev=ev@entry=0x7fffffffc430)
    at gui/simwin.cc:1427
#12 0x0000000000677495 in interaction_t::process_event (
    this=this@entry=0x147efa0, ev=...) at siminteraction.cc:380
#13 0x0000000000677b2b in interaction_t::check_events (this=0x147efa0)
    at siminteraction.cc:453
#14 0x00000000006cfb97 in karte_t::interactive (this=this@entry=0x11a6480,
    quit_month=quit_month@entry=2147483647) at simworld.cc:6519
#15 0x000000000067fbb7 in simu_main (argc=argc@entry=1,
    argv=argv@entry=0x7fffffffe218) at simmain.cc:1312
#16 0x0000000000693124 in sysmain (argc=1, argv=0x7fffffffe218)
    at simsys.cc:805
#17 0x00007ffff66fab45 in __libc_start_main (
    main=0x40a5b0 <main(int, char**)>, argc=1, argv=0x7fffffffe218,
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=0x7fffffffe208) at libc-start.c:287
#18 0x000000000040a5de in _start ()



Dwachs

Thanks for the backtrace. It seems that the variable 'alive', which was introduced in r7802, needs to be protected by some mutex mechanism. Otherwise race conditions may occur, like in this bug report.
Parsley, sage, rosemary, and maggikraut.

Dwachs

Parsley, sage, rosemary, and maggikraut.


Dwachs

Parsley, sage, rosemary, and maggikraut.