Openapoc: macOS: "Abandon and Restart game" --> "Start campaign game" sometimes crashes

Created on 28 Apr 2019  路  2Comments  路  Source: OpenApoc/OpenApoc

Here is one case that reliably reproduces, but I think there are others:

  1. Run OpenApoc
  2. Start new game in superhuman
  3. Options --> "Abandon and Restart game" (goes back to main menu)
  4. Start new game in superhuman
    --> Crash
W 9615745276 void OpenApoc::City::initialSceneryLinkUp(): Begun scenery link up!
W 9699892947 void OpenApoc::City::initialSceneryLinkUp(): Begun scenery link up cycle!
W 9726545156 void OpenApoc::City::initialSceneryLinkUp(): Attempting link up of unlinked parts
W 9772007758 void OpenApoc::City::initialSceneryLinkUp(): Link up finished!
W 9773366767 void OpenApoc::GameState::validate(): Validating GameState
W 9783263046 void OpenApoc::GameState::validate(): Validated GameState
/Users/ice/PycharmProjects/openapoc/OpenApoc/forms/scrollbar.cpp:215:38: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Users/ice/PycharmProjects/openapoc/OpenApoc/forms/scrollbar.cpp:215:38 in 

// Step 4: Click "Superhuman"

AddressSanitizer:DEADLYSIGNAL
=================================================================
==45956==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fff36d106c4 bp 0x70000f7766f0 sp 0x70000f7766f0 T4)
==45956==The signal is caused by a READ memory access.
==45956==Hint: address points to the zero page.
    #0 0x7fff36d106c3 in glDeleteTextures (libGL.dylib:x86_64+0x16c3)
    #1 0x10b81ed15 in (anonymous namespace)::GLPaletteImage::~GLPaletteImage() gl_2_0.hpp:1996
    #2 0x10b81eddf in (anonymous namespace)::GLPaletteImage::~GLPaletteImage() ogl_2_0_renderer.cpp:651
    #3 0x10b81f3f9 in std::__1::__shared_ptr_pointer<(anonymous namespace)::GLPaletteImage*, std::__1::default_delete<(anonymous namespace)::GLPaletteImage>, std::__1::allocator<(anonymous namespace)::GLPaletteImage> >::__on_zero_shared() memory:2335
    #4 0x10b64b732 in std::__1::__shared_weak_count::__release_shared() memory:3540
    #5 0x10b6418e3 in OpenApoc::Image::~Image() memory:4516
    #6 0x10b6179e2 in std::__1::__shared_weak_count::__release_shared() memory:3540
    #7 0x10b72ed86 in std::__1::__vector_base<std::__1::shared_ptr<OpenApoc::Image>, std::__1::allocator<std::__1::shared_ptr<OpenApoc::Image> > >::clear() memory:4516
    #8 0x10b72ec23 in std::__1::__vector_base<std::__1::shared_ptr<OpenApoc::Image>, std::__1::allocator<std::__1::shared_ptr<OpenApoc::Image> > >::~__vector_base() vector:458
    #9 0x10b76afd1 in OpenApoc::ImageSet::~ImageSet() vector:464
    #10 0x10b590cb2 in std::__1::__shared_weak_count::__release_shared() memory:3540
    #11 0x10b5b4c90 in std::__1::deque<std::__1::shared_ptr<OpenApoc::ImageSet>, std::__1::allocator<std::__1::shared_ptr<OpenApoc::ImageSet> > >::pop_front() memory:4516
    #12 0x10b54cfac in OpenApoc::DataImpl::loadImageSet(OpenApoc::UString const&) queue:321
    #13 0x10b5441b0 in OpenApoc::DataImpl::loadImage(OpenApoc::UString const&, bool) data.cpp:497
    #14 0x10c43a059 in OpenApoc::serializeIn(OpenApoc::GameState const*, OpenApoc::SerializationNode*, std::__1::shared_ptr<OpenApoc::Image>&) gamestate_serialize.cpp:90
    #15 0x10c597a9d in OpenApoc::serializeIn(OpenApoc::GameState const*, OpenApoc::SerializationNode*, OpenApoc::VehicleType&) gamestate_serialize_generated.cpp:5046
    #16 0x10c5957cc in void OpenApoc::serializeIn<OpenApoc::VehicleType>(OpenApoc::GameState const*, OpenApoc::SerializationNode*, std::__1::shared_ptr<OpenApoc::VehicleType>&) gamestate_serialize.h:167
    #17 0x10c470ea4 in void OpenApoc::serializeIn<OpenApoc::UString, std::__1::shared_ptr<OpenApoc::VehicleType> >(OpenApoc::GameState const*, OpenApoc::SerializationNode*, std::__1::map<OpenApoc::UString, std::__1::shared_ptr<OpenApoc::VehicleType>, std::__1::less<OpenApoc::UString>, std::__1::allocator<std::__1::pair<OpenApoc::UString const, std::__1::shared_ptr<OpenApoc::VehicleType> > > >&) gamestate_serialize.h:228
    #18 0x10c46bbc6 in OpenApoc::serializeIn(OpenApoc::GameState const*, OpenApoc::SerializationNode*, OpenApoc::GameState&) gamestate_serialize_generated.cpp:587
    #19 0x10c44da12 in OpenApoc::GameState::deserialize(OpenApoc::SerializationArchive*) gamestate_serialize.cpp:481
    #20 0x10c44d1e3 in OpenApoc::GameState::loadGame(OpenApoc::UString const&) gamestate_serialize.cpp:457
    #21 0x10d4eaf28 in decltype(std::__1::forward<OpenApoc::loadGame(OpenApoc::UString const&, std::__1::shared_ptr<OpenApoc::GameState>)::$_0&>(fp)()) std::__1::__invoke<OpenApoc::loadGame(OpenApoc::UString const&, std::__1::shared_ptr<OpenApoc::GameState>)::$_0&>(OpenApoc::loadGame(OpenApoc::UString const&, std::__1::shared_ptr<OpenApoc::GameState>)::$_0&&&) difficultymenu.cpp:42
    #22 0x10dc2552a in std::__1::packaged_task<void ()>::operator()() future:1998
    #23 0x10d4f209b in decltype(std::__1::forward<OpenApoc::loadGame(OpenApoc::UString const&, std::__1::shared_ptr<OpenApoc::GameState>)::$_0>(fp)()) std::__1::__invoke<std::__1::shared_future<std::__1::result_of<OpenApoc::loadGame(OpenApoc::UString const&, std::__1::shared_ptr<OpenApoc::GameState>)::$_0 ()>::type> OpenApoc::Framework::threadPoolEnqueue<OpenApoc::loadGame(OpenApoc::UString const&, std::__1::shared_ptr<OpenApoc::GameState>)::$_0>(OpenApoc::loadGame(OpenApoc::UString const&, std::__1::shared_ptr<OpenApoc::GameState>)::$_0&&)::'lambda'()&>(OpenApoc::loadGame(OpenApoc::UString const&, std::__1::shared_ptr<OpenApoc::GameState>)::$_0&&) framework.h:108
    #24 0x10b60de19 in ThreadPool::ThreadPool(unsigned long)::'lambda'()::operator()() const ThreadPool.h:60
    #25 0x10b60cdcf in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, ThreadPool::ThreadPool(unsigned long)::'lambda'()> >(void*) thread:352
    #26 0x7fff5a2e42ea in _pthread_body (libsystem_pthread.dylib:x86_64+0x32ea)
    #27 0x7fff5a2e7248 in _pthread_start (libsystem_pthread.dylib:x86_64+0x6248)
    #28 0x7fff5a2e340c in thread_start (libsystem_pthread.dylib:x86_64+0x240c)

==45956==Register values:
rax = 0x0000000000000031  rbx = 0x00007fff36d106b2  rcx = 0x0000000000000001  rdx = 0x0000000000000000  
rdi = 0x0000000000000001  rsi = 0x00006040037b1d98  rbp = 0x000070000f7766f0  rsp = 0x000070000f7766f0  
 r8 = 0x00006040037b1d98   r9 = 0x00000fffffffffff  r10 = 0x0000000000000000  r11 = 0xffffffffffffffff  
r12 = 0x9ddfea08eb382d69  r13 = 0x2a7d2d0050950ac2  r14 = 0x00006040037b1d98  r15 = 0x00006040037b1d90  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libGL.dylib:x86_64+0x16c3) in glDeleteTextures
Thread T4 created by T0 here:
    #0 0x11448102d in wrap_pthread_create (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x5402d)
    #1 0x10b60c824 in std::__1::thread::thread<ThreadPool::ThreadPool(unsigned long)::'lambda'(), void>(ThreadPool::ThreadPool(unsigned long)::'lambda'()&&) __threading_support:328
    #2 0x10b60acb4 in ThreadPool::ThreadPool(unsigned long) memory:1560
    #3 0x10b609694 in OpenApoc::FrameworkPrivate::FrameworkPrivate() ThreadPool.h:37
    #4 0x10b5e3ef9 in OpenApoc::Framework::Framework(OpenApoc::UString, bool) framework.cpp:379
    #5 0x10b467c01 in main main.cpp:24
    #6 0x7fff5a0f63d4 in start (libdyld.dylib:x86_64+0x163d4)

==45956==ABORTING
Abort trap: 6
!BUG! HIGH PRIORITY !BUG! low priority MacOs

Most helpful comment

Yeah, that's another threaded GL issue.

Not a trivial fix, unfortunately, but it's being worked on.

All 2 comments

A similar SEGV occurs when trying to initiate any battle, e.g.

  1. Start a new game
  2. Send some agents to any org's building
  3. Try to raid it
CLICKED OK SCENERY CITYTILE_CITYMAP_271 at {28,53,6} BUILDING BUILDING_TEMPLE_OF_THE_APOCALYPSE
Ht [16] Con [30] Type [0|0|0] Road [0000] Hill [0000] Tube [000000]
Can be supported by {28,53,5}
Supports {28,53,7}
Actually supported by CITYTILE_CITYMAP_271 at 0 0 -1
W 113079217590 bool OpenApoc::BattleMap::generateMap(std::vector<sp<BattleMapSector> > &, Vec3<int> &, OpenApoc::GameState &, OpenApoc::BattleMap::GenerationSize): Successfully completed map BATTLEMAP_36church with size 2, 3, 1 at attempt 1
AddressSanitizer:DEADLYSIGNAL
=================================================================
==46988==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fff36d106c4 bp 0x700007123450 sp 0x700007123450 T4)
==46988==The signal is caused by a READ memory access.
==46988==Hint: address points to the zero page.
    #0 0x7fff36d106c3 in glDeleteTextures (libGL.dylib:x86_64+0x16c3)
    #1 0x105748eb5 in (anonymous namespace)::GLRGBImage::~GLRGBImage() gl_2_0.hpp:1996
    #2 0x105748f7f in (anonymous namespace)::GLRGBImage::~GLRGBImage() ogl_2_0_renderer.cpp:609
    #3 0x105749599 in std::__1::__shared_ptr_pointer<(anonymous namespace)::GLRGBImage*, std::__1::default_delete<(anonymous namespace)::GLRGBImage>, std::__1::allocator<(anonymous namespace)::GLRGBImage> >::__on_zero_shared() memory:2335
    #4 0x105586732 in std::__1::__shared_weak_count::__release_shared() memory:3540
    #5 0x10557c8e3 in OpenApoc::Image::~Image() memory:4516
    #6 0x1055529e2 in std::__1::__shared_weak_count::__release_shared() memory:3540
    #7 0x1054f7240 in std::__1::deque<std::__1::shared_ptr<OpenApoc::Image>, std::__1::allocator<std::__1::shared_ptr<OpenApoc::Image> > >::pop_front() memory:4516
    #8 0x105481483 in OpenApoc::DataImpl::loadImage(OpenApoc::UString const&, bool) queue:321
    #9 0x106375059 in OpenApoc::serializeIn(OpenApoc::GameState const*, OpenApoc::SerializationNode*, std::__1::shared_ptr<OpenApoc::Image>&) gamestate_serialize.cpp:90
    #10 0x106a01dc4 in OpenApoc::serializeIn(OpenApoc::GameState const*, OpenApoc::SerializationNode*, OpenApoc::BattleMapPartType&) gamestate_serialize_generated.cpp:2313
    #11 0x1069ff0cc in void OpenApoc::serializeIn<OpenApoc::BattleMapPartType>(OpenApoc::GameState const*, OpenApoc::SerializationNode*, std::__1::shared_ptr<OpenApoc::BattleMapPartType>&) gamestate_serialize.h:167
    #12 0x1063ffe64 in void OpenApoc::serializeIn<OpenApoc::UString, std::__1::shared_ptr<OpenApoc::BattleMapPartType> >(OpenApoc::GameState const*, OpenApoc::SerializationNode*, std::__1::map<OpenApoc::UString, std::__1::shared_ptr<OpenApoc::BattleMapPartType>, std::__1::less<OpenApoc::UString>, std::__1::allocator<std::__1::pair<OpenApoc::UString const, std::__1::shared_ptr<OpenApoc::BattleMapPartType> > > >&) gamestate_serialize.h:228
    #13 0x1063ff87b in OpenApoc::serializeIn(OpenApoc::GameState const*, OpenApoc::SerializationNode*, OpenApoc::BattleMapTileset&) gamestate_serialize_generated.cpp:791
    #14 0x10638a574 in OpenApoc::deserialize(OpenApoc::BattleMapTileset&, OpenApoc::GameState const&, OpenApoc::SerializationArchive*) gamestate_serialize.cpp:511
    #15 0x10638a015 in OpenApoc::BattleMapTileset::loadTileset(OpenApoc::GameState&, OpenApoc::UString const&) gamestate_serialize.cpp:544
    #16 0x1060a4e6c in OpenApoc::BattleMap::loadTilesets(OpenApoc::GameState&) const battlemap.cpp:1551
    #17 0x105a76dce in OpenApoc::Battle::loadResources(OpenApoc::GameState&) battle.cpp:3462
    #18 0x106088192 in OpenApoc::BattleMap::fillMap(std::__1::vector<std::__1::list<std::__1::pair<glm::vec<3, int, (glm::qualifier)0>, std::__1::shared_ptr<OpenApoc::BattleMapPart> >, std::__1::allocator<std::__1::pair<glm::vec<3, int, (glm::qualifier)0>, std::__1::shared_ptr<OpenApoc::BattleMapPart> > > >, std::__1::allocator<std::__1::list<std::__1::pair<glm::vec<3, int, (glm::qualifier)0>, std::__1::shared_ptr<OpenApoc::BattleMapPart> >, std::__1::allocator<std::__1::pair<glm::vec<3, int, (glm::qualifier)0>, std::__1::shared_ptr<OpenApoc::BattleMapPart> > > > > >&, bool&, std::__1::vector<std::__1::shared_ptr<OpenApoc::BattleMapSector>, std::__1::allocator<std::__1::shared_ptr<OpenApoc::BattleMapSector> > >, glm::vec<3, int, (glm::qualifier)0>, OpenApoc::GameState&, OpenApoc::StateRef<OpenApoc::Organisation>, OpenApoc::StateRef<OpenApoc::Organisation>, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >&, OpenApoc::StateRef<OpenApoc::Vehicle>, OpenApoc::Battle::MissionType, OpenApoc::UString) battlemap.cpp:1006
    #19 0x10606de24 in OpenApoc::BattleMap::createBattle(OpenApoc::GameState&, OpenApoc::StateRef<OpenApoc::Organisation>, OpenApoc::StateRef<OpenApoc::Organisation>, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >&, OpenApoc::StateRef<OpenApoc::Vehicle>, OpenApoc::Battle::MissionType, OpenApoc::UString) battlemap.cpp:1496
    #20 0x106072777 in OpenApoc::BattleMap::createBattle(OpenApoc::GameState&, OpenApoc::StateRef<OpenApoc::Organisation>, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >&, std::__1::map<OpenApoc::StateRef<OpenApoc::AgentType>, int, std::__1::less<OpenApoc::StateRef<OpenApoc::AgentType> >, std::__1::allocator<std::__1::pair<OpenApoc::StateRef<OpenApoc::AgentType> const, int> > > const*, int const*, int const*, OpenApoc::StateRef<OpenApoc::Vehicle>, OpenApoc::StateRef<OpenApoc::Building>) battlemap.cpp:375
    #21 0x105adadd5 in OpenApoc::Battle::beginBattle(OpenApoc::GameState&, bool, OpenApoc::StateRef<OpenApoc::Organisation>, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >&, std::__1::map<OpenApoc::StateRef<OpenApoc::AgentType>, int, std::__1::less<OpenApoc::StateRef<OpenApoc::AgentType> >, std::__1::allocator<std::__1::pair<OpenApoc::StateRef<OpenApoc::AgentType> const, int> > > const*, int const*, int const*, OpenApoc::StateRef<OpenApoc::Vehicle>, OpenApoc::StateRef<OpenApoc::Building>) battle.cpp:2470
    #22 0x10720519a in decltype(std::__1::forward<OpenApoc::(anonymous namespace)::loadBattleBuilding(std::__1::shared_ptr<OpenApoc::GameState>, std::__1::shared_ptr<OpenApoc::Building>, bool, bool, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >, OpenApoc::StateRef<OpenApoc::Vehicle>)::$_0&>(fp)()) std::__1::__invoke<OpenApoc::(anonymous namespace)::loadBattleBuilding(std::__1::shared_ptr<OpenApoc::GameState>, std::__1::shared_ptr<OpenApoc::Building>, bool, bool, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >, OpenApoc::StateRef<OpenApoc::Vehicle>)::$_0&>(OpenApoc::(anonymous namespace)::loadBattleBuilding(std::__1::shared_ptr<OpenApoc::GameState>, std::__1::shared_ptr<OpenApoc::Building>, bool, bool, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >, OpenApoc::StateRef<OpenApoc::Vehicle>)::$_0&&&) buildingscreen.cpp:42
    #23 0x107b6052a in std::__1::packaged_task<void ()>::operator()() future:1998
    #24 0x1072077eb in decltype(std::__1::forward<OpenApoc::(anonymous namespace)::loadBattleBuilding(std::__1::shared_ptr<OpenApoc::GameState>, std::__1::shared_ptr<OpenApoc::Building>, bool, bool, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >, OpenApoc::StateRef<OpenApoc::Vehicle>)::$_0>(fp)()) std::__1::__invoke<std::__1::shared_future<std::__1::result_of<OpenApoc::(anonymous namespace)::loadBattleBuilding(std::__1::shared_ptr<OpenApoc::GameState>, std::__1::shared_ptr<OpenApoc::Building>, bool, bool, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >, OpenApoc::StateRef<OpenApoc::Vehicle>)::$_0 ()>::type> OpenApoc::Framework::threadPoolEnqueue<OpenApoc::(anonymous namespace)::loadBattleBuilding(std::__1::shared_ptr<OpenApoc::GameState>, std::__1::shared_ptr<OpenApoc::Building>, bool, bool, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >, OpenApoc::StateRef<OpenApoc::Vehicle>)::$_0>(OpenApoc::(anonymous namespace)::loadBattleBuilding(std::__1::shared_ptr<OpenApoc::GameState>, std::__1::shared_ptr<OpenApoc::Building>, bool, bool, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >, OpenApoc::StateRef<OpenApoc::Vehicle>)::$_0&&)::'lambda'()&>(OpenApoc::(anonymous namespace)::loadBattleBuilding(std::__1::shared_ptr<OpenApoc::GameState>, std::__1::shared_ptr<OpenApoc::Building>, bool, bool, std::__1::list<OpenApoc::StateRef<OpenApoc::Agent>, std::__1::allocator<OpenApoc::StateRef<OpenApoc::Agent> > >, OpenApoc::StateRef<OpenApoc::Vehicle>)::$_0&&) framework.h:108
    #25 0x105548e19 in ThreadPool::ThreadPool(unsigned long)::'lambda'()::operator()() const ThreadPool.h:60
    #26 0x105547dcf in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, ThreadPool::ThreadPool(unsigned long)::'lambda'()> >(void*) thread:352
    #27 0x7fff5a2e42ea in _pthread_body (libsystem_pthread.dylib:x86_64+0x32ea)
    #28 0x7fff5a2e7248 in _pthread_start (libsystem_pthread.dylib:x86_64+0x6248)
    #29 0x7fff5a2e340c in thread_start (libsystem_pthread.dylib:x86_64+0x240c)

==46988==Register values:
rax = 0x0000000000000045  rbx = 0x00007fff36d106b2  rcx = 0x0000000000000001  rdx = 0x0000000000000000  
rdi = 0x0000000000000001  rsi = 0x0000604000450f98  rbp = 0x0000700007123450  rsp = 0x0000700007123450  
 r8 = 0x0000604000450f98   r9 = 0x00000fffffffffff  r10 = 0x0000700007122d88  r11 = 0x0000000000000000  
r12 = 0x9ddfea08eb382d69  r13 = 0x51a18e32b4d111b4  r14 = 0x0000604000450f98  r15 = 0x0000604000450f90  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libGL.dylib:x86_64+0x16c3) in glDeleteTextures
Thread T4 created by T0 here:
    #0 0x10e3b702d in wrap_pthread_create (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x5402d)
    #1 0x105547824 in std::__1::thread::thread<ThreadPool::ThreadPool(unsigned long)::'lambda'(), void>(ThreadPool::ThreadPool(unsigned long)::'lambda'()&&) __threading_support:328
    #2 0x105545cb4 in ThreadPool::ThreadPool(unsigned long) memory:1560
    #3 0x105544694 in OpenApoc::FrameworkPrivate::FrameworkPrivate() ThreadPool.h:37
    #4 0x10551eef9 in OpenApoc::Framework::Framework(OpenApoc::UString, bool) framework.cpp:379
    #5 0x1053a2c01 in main main.cpp:24
    #6 0x7fff5a0f63d4 in start (libdyld.dylib:x86_64+0x163d4)

==46988==ABORTING
Abort trap: 6

Yeah, that's another threaded GL issue.

Not a trivial fix, unfortunately, but it's being worked on.

Was this page helpful?
0 / 5 - 0 ratings