News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Linux: Simutrans closes suddenly.

Started by Yona-TYT, August 09, 2016, 07:54:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

Quote from: Ters on July 10, 2016, 02:06:24 PM
Run it with a debugger, as long as the executable has debugging symbols. The debugger must match the compiler used. For Linux, it is most certainly GDB. It might be so on Windows, or it might be one of Microsoft's debuggers, which are available in the Windows SDK, which is now only available with Visual Studio.


This is my first attempt with "gdb" do not know if this is good. ???

(gdb) run
Starting program: /home/yona/Descargas/simutrans/simutrans
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Missing separate debuginfo for /lib/libbz2.so.1.0
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/53/bc0767f9669e60c1b79ec494fac3fadf5d056f.debug
Use work dir /home/yona/Descargas/simutrans/
Reading low level config data ...
parse_simuconf() at config/simuconf.tab: Reading simuconf.tab successful!
Preparing display ...
[New Thread 0xb767cb40 (LWP 7119)]
SDL_driver=x11, hw_available=0, video_mem=0, blit_sw=0, bpp=32, bytes=4
Screen Flags: requested=10, actual=10
dr_os_open(SDL): SDL realized screen size width=704, height=560 (requested w=704, h=560)
Loading font 'font/prop.fnt'
font/prop.fnt successfully loaded as old format prop font!
Init done.
parse_simuconf() at pak128/config/simuconf.tab:
Reading simuconf.tab successful!
[New Thread 0xb25f9b40 (LWP 7120)]
[Thread 0xb25f9b40 (LWP 7120) exited]
[New Thread 0xb25f9b40 (LWP 7121)]
Reading compatibility sound data ...
Loaded /home/yona/Descargas/simutrans/pak128/sound/engine-start-diesel-1.wav to sample 0.
Loaded /home/yona/Descargas/simutrans/pak128/sound/engine-start-diesel_d.wav to sample 1.
Loaded /home/yona/Descargas/simutrans/pak128/sound/train-horn-diesel-0.wav to sample 2.
Loaded /home/yona/Descargas/simutrans/pak128/sound/train-horn-steam-0.wav to sample 3.
Loaded /home/yona/Descargas/simutrans/pak128/sound/click.wav to sample 4.
Loaded /home/yona/Descargas/simutrans/pak128/sound/boing.wav to sample 5.
Loaded /home/yona/Descargas/simutrans/pak128/sound/jackhammer.wav to sample 6.
Loaded /home/yona/Descargas/simutrans/pak128/sound/gavel.wav to sample 7.
Loaded /home/yona/Descargas/simutrans/pak128/sound/dock.wav to sample 8.
Loaded /home/yona/Descargas/simutrans/pak128/sound/explosion.wav to sample 9.
Loaded /home/yona/Descargas/simutrans/pak128/sound/cash.wav to sample 10.
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/beaches.wav)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/forest.wav)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/Water.wav)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/desert.wav)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/tropic.wav)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/mediterran.wav)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/temperate.wav)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/tundra.wav)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/rocky.wav)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/arctic.wav)
Loading BDF font 'cyr.bdf'
Reading city configuration ...
Reading speedbonus configuration ...
Reading menu configuration ...
Reading object data from pak128/...
Loaded /home/yona/Descargas/simutrans/pak128/sound/train-horn-steam-1.wav to sample 11.
Loaded /home/yona/Descargas/simutrans/pak128/sound/ship-horn_a.wav to sample 12.
Loaded /home/yona/Descargas/simutrans/pak128/sound/ship-horn_b.wav to sample 13.
Loaded /home/yona/Descargas/simutrans/pak128/sound/train-horn-electric-0.wav to sample 14.
Loaded /home/yona/Descargas/simutrans/pak128/sound/engine-start-petrol-2.wav to sample 15.
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/engine-start-diesel_0)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/engine-start-diesel_0)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/engine-start-diesel_0)
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/engine-start-diesel_0)
Loaded /home/yona/Descargas/simutrans/pak128/sound/engine-start-petrol-1.wav to sample 16.
Loaded /home/yona/Descargas/simutrans/pak128/sound/engine-start-diesel-0.wav to sample 17.
could not load wav (Couldn't open /home/yona/Descargas/simutrans/pak128/sound/truck.wav)
Reading menu configuration ...
Midi disabled ...
Calculating textures ...done
[New Thread 0xad36ab40 (LWP 7122)]
[New Thread 0xacb69b40 (LWP 7123)]
[New Thread 0xac368b40 (LWP 7124)]
expose: x=1440, y=825
textur_resize()::screen=0x85da238
Creating cities ...
Creating cities: 1
Creating factories ...
Distributing 1 tourist attractions ...
Preparing startup ...
Loading BDF font 'cyr.bdf'
Show banner ...
[New Thread 0xa994db40 (LWP 7125)]
[New Thread 0xa914cb40 (LWP 7126)]
[New Thread 0xa894bb40 (LWP 7127)]
Running world, pause=0, fast forward=0 ...
World destroyed.
[New Thread 0xa814ab40 (LWP 7128)]
[Thread 0xa814ab40 (LWP 7128) exited]
World finished ...
Show banner ...
Running world, pause=0, fast forward=0 ...
set_zoom_factor() : set 4 (3/4)
set_zoom_factor() : set 5 (5/8)
set_zoom_factor() : set 6 (1/2)
set_zoom_factor() : set 7 (3/8)
set_zoom_factor() : set 8 (1/4)
set_zoom_factor() : set 9 (1/8)
set_zoom_factor() : set 8 (1/4)
set_zoom_factor() : set 7 (3/8)
set_zoom_factor() : set 6 (1/2)
set_zoom_factor() : set 7 (3/8)
set_zoom_factor() : set 8 (1/4)
set_zoom_factor() : set 9 (1/8)
set_zoom_factor() : set 8 (1/4)
set_zoom_factor() : set 7 (3/8)
set_zoom_factor() : set 6 (1/2)
set_zoom_factor() : set 7 (3/8)
set_zoom_factor() : set 8 (1/4)
set_zoom_factor() : set 9 (1/8)
set_zoom_factor() : set 8 (1/4)
set_zoom_factor() : set 7 (3/8)
set_zoom_factor() : set 6 (1/2)
set_zoom_factor() : set 5 (5/8)
set_zoom_factor() : set 4 (3/4)
set_zoom_factor() : set 3 (1/1)
set_zoom_factor() : set 2 (4/3)
set_zoom_factor() : set 1 (3/2)
set_zoom_factor() : set 0 (2/1)
set_zoom_factor() : set 1 (3/2)
set_zoom_factor() : set 2 (4/3)
set_zoom_factor() : set 3 (1/1)
set_zoom_factor() : set 4 (3/4)
set_zoom_factor() : set 5 (5/8)
set_zoom_factor() : set 6 (1/2)
set_zoom_factor() : set 7 (3/8)
set_zoom_factor() : set 8 (1/4)
set_zoom_factor() : set 9 (1/8)


Thread 10 "simutrans" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xa894bb40 (LWP 7127)]
0x080f204f in ?? ()

captain crunch

> This is my first attempt with "gdb" do not know if this is good. ???

What you posted is not much help in finding the source of the segmentation fault.
Please post the output of of the gdb command "where".

Yona-TYT



(gdb) where
#0  0x080f204f in ?? ()
#1  0x080f26ec in ?? ()
#2  0x080f2f7f in ?? ()
#3  0x080968f5 in ?? ()
#4  0x08097a3a in ?? ()
#5  0x080fb0dc in ?? ()
#6  0x080f9a2d in ?? ()
#7  0xb7f9d3ee in start_thread (arg=0xa8fd8b40) at pthread_create.c:333
#8  0xb7bfe9fe in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:114



It is helpful this ??.

Ters

Your Simutrans lacks debugging information. All I can get out of it is that it appears to have crashed in a thread other than the main one. It seems totally unrelated to what this topic was about.

Yona-TYT

Quote from: Ters on August 09, 2016, 04:05:50 PM
Your Simutrans lacks debugging information. All I can get out of it is that it appears to have crashed in a thread other than the main one. It seems totally unrelated to what this topic was about.
I should have created a new topic... sorry.

Yona-TYT


I think this is the backtrace.  ???


Quote from: Yona-TYT on August 09, 2016, 02:49:34 PM

(gdb) where
#0  0x080f204f in ?? ()
#1  0x080f26ec in ?? ()
#2  0x080f2f7f in ?? ()
#3  0x080968f5 in ?? ()
#4  0x08097a3a in ?? ()
#5  0x080fb0dc in ?? ()
#6  0x080f9a2d in ?? ()
#7  0xb7f9d3ee in start_thread (arg=0xa8fd8b40) at pthread_create.c:333
#8  0xb7bfe9fe in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:114





It is helpful this ??.

DrSuperGood

Without the debug symbols for that particular build unfortunately that trace cannot be used to locate the cause of the problem.

When does Simutrans close suddenly? Does it get to the main menu? Does it crash at a particular point when playing a particular save/map? Is it just that a save/map is highly prone to crashing at random times? Can you recreate this problem on other installs/computers?

Ters

More details are here, except that the first few posts are about something different. A moderator should have move those posts here. Or rather, a moderator should have split those posts into a different topic and Yona-TYT should not have startet a new topic without context.

Dwachs

Tried to split/ merge topice. Please  continue discussion about this fatal error here.
Parsley, sage, rosemary, and maggikraut.

Dwachs

@Yona: which revision did you test? I hoped that this crash was fixed with r7851
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

Quote from: Dwachs on August 11, 2016, 06:09:21 AM
@Yona: which revision did you test? I hoped that this crash was fixed with r7851
The r7855

Yona-TYT

Quote from: DrSuperGood on August 11, 2016, 03:02:30 AM
Without the debug symbols for that particular build unfortunately that trace cannot be used to locate the cause of the problem.

When does Simutrans close suddenly? Does it get to the main menu? Does it crash at a particular point when playing a particular save/map? Is it just that a save/map is highly prone to crashing at random times? Can you recreate this problem on other installs/computers?


The game is loaded normally, but when I try to move across the map the error occurs.


Ters

Assuming that we are talking about the Linux build from the nightly site, I can say from the stack trace that it crashes loading a 16-bit value from a pointer passed as the third parameter to a function. That word would have later been and-ed with at least two local variables (independently). I don't know if anyone knows the code well enough to recognize any piece of code from that description. And-ing of 16-bit values loaded via pointers keeps me thinking of rendering code.

By the way, the nightly code looks unoptimized, although I could be wrong. Seems rather pointless to not optimize, when debugging is not possible anyway.

DrSuperGood

Quote
The game is loaded normally, but when I try to move across the map the error occurs.
A specific map? Or any map?


Dwachs

Just insert

assert( runlen == (*(alphamap) & ~TRANSPARENT_RUN) );

after 3624 in simgraph16.cc. These runlengths should be the same for image and alpha map. This is what the code assumes. If not then there might be crashes.

For some water climate overlay in certain zoom this assertion fails (pak128).
Parsley, sage, rosemary, and maggikraut.

Ters

One good reason to keep alpha and color in the same data stream.

prissi

In principle the new image display routines would allow for that ...

DrSuperGood

#18
I can recreate this crash on windows with a self build. Will investigate further.

Below is
Quote
>   Simutrans Release Dev.exe!display_rezoomed_img_alpha(const unsigned int n, const unsigned int alpha_n, const unsigned int alpha_flags, short xp, short yp, const char __formal, const unsigned short color_index, const int __formal, const int dirty, const char clip_num) Line 3825   C++
   Simutrans Release Dev.exe!grund_t::display_boden(const short xpos, const short ypos, const short raster_tile_width, const char clip_num, bool force_show_grid) Line 1112   C++
   Simutrans Release Dev.exe!grund_t::display_if_visible(short xpos, short ypos, const short raster_tile_width, const char clip_num, bool force_show_grid) Line 1258   C++
   Simutrans Release Dev.exe!karte_ansicht_t::display_region(koord lt, koord wh, short y_min, const short y_max, bool threaded, bool clip_num, const char) Line 375   C++
   Simutrans Release Dev.exe!display_region_thread(void * ptr) Line 73   C++

alphamap += (*alphamap) & (~TRANSPARENT_RUN);

alphamap is pointing to invalid memory.

Due to the strange nature of how alpha is done, I will need to do a lot more reading to understand what is going on.

Dwachs

Please try again with r7857. It appears that the alpha-maps contained a pixel with 0x8000 bit set, which indicates special colors and confused the rezoom-routines. The bit will now always be cleared when all the alpha-maps are computed.

I do not know how to properly warn pakset authors about this.
Parsley, sage, rosemary, and maggikraut.

Ters

Quote from: Dwachs on August 12, 2016, 08:38:25 PM
I do not know how to properly warn pakset authors about this.

makeobj could emit an error, or at least a warning. As for paks already made, we might hope that they read this forum. That is how they would have learned of this feature, isn't it?

Dwachs

It turned out that the images were fine. There was an integer underflow in create_alpha_tile, which accessed image data out-of-bound - with small negative index such that the memory was still valid. Should be fixed in r7858.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

Quote from: Dwachs on August 12, 2016, 09:32:55 PM
It turned out that the images were fine. There was an integer underflow in create_alpha_tile, which accessed image data out-of-bound - with small negative index such that the memory was still valid. Should be fixed in r7858.
Solved, thanks! ;D

prissi

there would be also the clamp macros for exactly that purpose ...