Author Topic: [fixed] r3207: Savegames: Segfault when savegame map is not available  (Read 738 times)

tomreyn

  • Local Moderator
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
If, for example, you create a savegame which was running on a map you later removed, you'll run into a segmentation fault:

Code: [Select]
./dev_rungame
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: option value of option vblank_mode ignored.
megaglest v3.6.1-dev
Compiled using: GNUC: 40601 [64bit] on: Mar 31 2012 15:09:09
SVN: [Rev: 3207M] - using STREFLOP [SSE] - [no-denormals]
[2012-03-31 20:19:19] *ERROR* In [program.cpp::setState Line: 569] Error [Map [no_such_map] not found, scenarioDir []]
Error saved to logfile [/home/tomreyn/.megaglest/error.log]
terminate called after throwing an instance of 'std::runtime_error'
  what():  font == NULL
[2012-03-31 20:19:19] *ERROR* In [/home/tomreyn/SCM/megaglest-trunk/source/glest_game/main/main.cpp::handleRuntimeError Line: 407] [font == NULL] gameInitialized = 1, program = 0x7f6e68000ad0
[2012-03-31 20:19:20] *ERROR* In [/home/tomreyn/SCM/megaglest-trunk/source/glest_game/main/main.cpp::handleRuntimeError Line: 494] [font == NULL
Stack Trace:
./megaglest:Glest::Game::glestMain(int, char**) address [0x61b445] line: 3898
./megaglest:Glest::Game::glestMainWrapper(int, char**) address [0x622b16] line: 4007
/lib/x86_64-linux-gnu/libc.so.6:__libc_start_main() address [0x7f6e79a2230d] line: 0
./megaglest() [0x4afa69] address [0x4afa69] line: 0
]

Segmentation fault detected, analyzing...

warning: [New LWP 31461]
[New LWP 31465]
[New LWP 31467]
[New LWP 31466]
[New LWP 31469]
[New LWP 31464]
[New LWP 31472]
[New LWP 31470]
[New LWP 31471]
Can't read pathname for load map: Eingabe-/Ausgabefehler.
[Thread debugging using libthread_db enabled]
64    ../nptl/sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht gefunden.
Core was generated by `./megaglest'.
Program terminated with signal 6, Aborted.
#0  0x00007f6e79a373a5 in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
    in ../nptl/sysdeps/unix/sysv/linux/raise.c
#0  0x00007f6e79a373a5 in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007f6e79a3ab0b in __GI_abort () at abort.c:92
#2  0x00007f6e7a073d7d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007f6e7a071f26 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007f6e7a071f53 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007f6e7a07204e in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00000000005c2e57 in Glest::Game::Renderer::getCentered3DPos (this=<optimized out>, text=..., font=<optimized out>, pos=..., w=<optimized out>, h=22, centeredW=true, centeredH=true) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/graphics/renderer.cpp:2403
#7  0x00000000005c370c in Glest::Game::Renderer::renderTextBoundingBox3D (this=0xc71260, text=..., font=0x0, color=..., x=<optimized out>, y=<optimized out>, w=90, h=22, centeredW=true, centeredH=true) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/graphics/renderer.cpp:2538
#8  0x00000000005c3c55 in Glest::Game::Renderer::renderButton (this=0xc71260, button=0x7f6e68018a70, fontColorOverride=<optimized out>, lightedOverride=0x0) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/graphics/renderer.cpp:2856
#9  0x00000000005c5f89 in renderButton (button=0x7f6e68018a70, this=<optimized out>, fontColorOverride=<optimized out>, lightedOverride=<optimized out>) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/graphics/renderer.cpp:2746
#10 Glest::Game::Renderer::renderMessageBox (this=0xc71260, messageBox=0x7f6e68000b20) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/graphics/renderer.cpp:3287
#11 0x00000000006347f4 in Glest::Game::Program::renderProgramMsgBox (this=0x7f6e68000ad0) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/main/program.cpp:476
#12 0x000000000063d137 in Glest::Game::Intro::render (this=0x7f6e5e107a10) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/main/intro.cpp:751
#13 0x0000000000632126 in Glest::Game::Program::loopWorker (this=0x7f6e68000ad0) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/main/program.cpp:391
#14 0x0000000000628995 in Glest::Game::ExceptionHandler::handleRuntimeError (msg=<optimized out>) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/main/main.cpp:512
#15 0x000000000061b445 in Glest::Game::glestMain (argc=<optimized out>, argv=<optimized out>) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/main/main.cpp:3898
#16 0x0000000000622b16 in Glest::Game::glestMainWrapper (argc=1, argv=0x7fff1e1e6c58) at /home/tomreyn/SCM/megaglest-trunk/source/glest_game/main/main.cpp:4005
#17 0x00007f6e79a2230d in __libc_start_main (main=0x4aa5f0 <main(int, char**)>, argc=1, ubp_av=0x7fff1e1e6c58, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff1e1e6c48) at libc-start.c:226
#18 0x00000000004afa69 in _start ()

The game should provide a user friendly on screen error message when any data referenced (and depended upon) by the savegame does not exist and there should be no segfault. Instead the game should return to the "Load game" or main menu in all cases but for missing tilesets, in which case a default replacement tileset should be loaded (this can be just the first one in the list of available tilesets), accompanied by a console warning message reporting the override.
« Last Edit: 20 July 2012, 15:26:58 by softcoder »
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

MuwuM

  • Ornithopter
  • *****
  • Posts: 426
  • No Game without Move(ment)
    • View Profile
    • MuwuM - Lexicons
Re: r3207: Savegames: Segfault when savegame map is not available
« Reply #1 on: 1 April 2012, 23:19:18 »
Similar Error in rev 3214 when a Lua - error appears (whould appear)

Code: [Select]
_CxxThrowException - throw.cpp [161]
Glest::Game::Renderer::getCentered3DPos - renderer.cpp [2405]
Glest::Game::Renderer::renderTextBoundingBox3D - renderer.cpp [2545]
Glest::Game::Renderer::renderButton - renderer.c []
full log

System: Win Vista 32bit

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: r3207: Savegames: Segfault when savegame map is not available
« Reply #2 on: 2 April 2012, 01:55:49 »
Try out svn, i tried hard to get a message showing of known errors, and unknown would give the standard line # etc, but at least it should not segfault in your test case.

tomreyn

  • Local Moderator
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: r3207: Savegames: Segfault when savegame map is not available
« Reply #3 on: 3 April 2012, 12:19:10 »
For my part this thread can be closed as [fixed], also because I had created a duplicate for no good reason. What do you say, MuWuM?
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

 

anything