2025-07-20 10:35 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004725Spring engineGeneralpublic2015-04-04 22:13
Reporterlamer 
Assigned TojK 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
Product Version98.0.1+git 
Target Version99.0Fixed in Version 
Summary0004725: 98.0.1-507-gcebb37a crash in GameHelper.cpp:661
DescriptionReplay crash. Happened in engine from buildbot and was reproduced in manually compiled version.
Steps To Reproduce$ ./spring Crash_Iceland_v1_98.0.1-507-gcebb37a develop.sdf
(run fast on 10x till ~20th minute, frame=0023055)
Additional Informationhttp://paste.springfiles.com/view/b08dc9e3

frame=0023055
 Segmentation fault (SIGSEGV) in spring 98.0.1-507-gcebb37a develop
 Halted Stacktrace for Spring 98.0.1-507-gcebb37a develop using libunwind:
 (Signal handler calls suppressed [4]. Inlined calls denoted by < > brackets.)
   <03> /usr/include/c++/4.9.2/bits/stl_vector.h:795 std::vector<std::list<CUnit*, std::allocator<CUnit*> >, std::allocator<std::list<CUnit*, std:: [...]
 [03] .../games/spring/spring/rts/Game/GameHelper.cpp:661 CGameHelper::GenerateWeaponTargets(CWeapon const*, CUnit const*, std::multimap<float, CUnit*, [...]
 [04] .../games/spring/spring/rts/Sim/Weapons/Weapon.cpp:749 CWeapon::AutoTarget()
 [05] .../games/spring/spring/rts/Sim/Weapons/Weapon.cpp:895 CWeapon::SlowUpdate(bool)
 [06] .../games/spring/spring/rts/Sim/Units/Unit.cpp:1108 CUnit::SlowUpdateWeapons()
 [07] .../games/spring/spring/rts/Sim/Units/Unit.cpp:1077 CUnit::SlowUpdate()
   <08> /usr/include/c++/4.9.2/bits/stl_list.h:159 std::_List_iterator<CUnit*>::operator++()
 [08] .../games/spring/spring/rts/Sim/Units/UnitHandler.cpp:288 CUnitHandler::Update()
 [09] .../games/spring/spring/rts/Game/Game.cpp:1577 CGame::SimFrame()
 [10] .../games/spring/spring/rts/Net/NetCommands.cpp:513 CGame::ClientReadNet()
 [11] .../games/spring/spring/rts/Game/Game.cpp:1023 CGame::Update()
 [12] .../games/spring/spring/rts/System/SpringApp.cpp:920 SpringApp::Update()
 [13] .../games/spring/spring/rts/System/SpringApp.cpp:954 SpringApp::Run()
 [14] .../games/spring/spring/rts/System/Main.cpp:48 Run(int, char**)
 [15] .../games/spring/spring/rts/System/Main.cpp:108 main
 [16] /usr/lib/libc.so.6(__libc_start_main+0xf0) [0x7f468b0d9800] __libc_start_main
 [17] ./spring(_start+0x29) [0x4aec39] ??
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0014266

lamer (reporter)

Uh oh. Zero-K $VERSION was used (commit d8e189c45a73ae4ab8fac287e68735a5b5feb8ce)
So i guess it will be harder to reproduce with attached replay than i thought.

~0014267

cleanrock (reporter)

Last edited: 2015-04-02 18:24

View 2 revisions

I can reproduce this with the attached demo.
The ref quads in GenerateWeaponTargets look fine (all ints are sane) when crash happen but the quadField->GetQuad gets a bad int (assert in GetQuad is triggered).
I suspected another thread called something that changed CQuadField::tempQuads but running with WorkerThreadCount = 0 did not help.
When i made quads in GenerateWeaponTargets a copy instead of a const ref to tempQuads crash did not happen, my guess is that something in the for loop in GenerateWeaponTargets changes tempQuads (there are a bunch of functions that do tempQuads.clear();).
jK, you should look into this.

~0014269

cleanrock (reporter)

I added a bunch of
  assert(qi >= quads.begin() && qi < quads.end());
it is the AllowWeaponTarget call that invalidates qi.

It is a Sharpshooter that is evaluating a Conjurer (cloaked constructor) as target.

~0014270

cleanrock (reporter)

Last edited: 2015-04-03 09:49

View 2 revisions

I guess we need a copy of the quads if we are doing callins here.

~0014271

cleanrock (reporter)

jk will fix this, from #sy:
2015-04-03 10:44:52: cleanrock: [LCC]jK, about 4725, shall i make quads a copy or do you have a different plan ?
2015-04-03 10:49:20: [LCC]jK: diff plan
2015-04-03 10:52:38: [LCC]jK: return a shared_ptr and check if it is unique when writing to the vector

~0014274

jK (developer)

Fix 4c0c12406dd19a8a4475e889614147a827e34afa committed to develop branch: fix 0004725: use explicit copy vector for the return results as cleanrock advised
I did checked how often there are conflicts by calling the functions in multi-level.
I used a shared_ptr for that and checked it with `assert(sptr.unique());` to ensure the tempQuads vector is not overwriten while still in use.
... ... ... the assert was triggered every few seconds ... ... ..., repo: spring changeset id: 4789
+Notes

-Issue History
Date Modified Username Field Change
2015-04-02 12:17 lamer New Issue
2015-04-02 12:17 lamer File Added: Crash_Iceland_v1_98.0.1-507-gcebb37a develop.sdf
2015-04-02 12:26 lamer Note Added: 0014266
2015-04-02 18:24 cleanrock Note Added: 0014267
2015-04-02 18:24 cleanrock Note Edited: 0014267 View Revisions
2015-04-02 18:26 abma Target Version => 99.0
2015-04-03 09:42 cleanrock Note Added: 0014269
2015-04-03 09:48 cleanrock Note Added: 0014270
2015-04-03 09:49 cleanrock Note Edited: 0014270 View Revisions
2015-04-04 07:12 cleanrock Note Added: 0014271
2015-04-04 22:13 jK Changeset attached => spring develop 4c0c1240
2015-04-04 22:13 jK Note Added: 0014274
2015-04-04 22:13 jK Assigned To => jK
2015-04-04 22:13 jK Status new => resolved
2015-04-04 22:13 jK Resolution open => fixed
+Issue History