View Issue Details

IDProjectCategoryView StatusLast Update
0000357Spring engineGeneralpublic2007-01-03 14:46
Reporterel_matarife Assigned Totvo  
PrioritynormalSeveritycrashReproducibilityhave not tried
Status resolvedResolutionfixed 
Summary0000357: -1 hitpoint unit leads to -1 experience point, crazed weapon speed and crash
Description5 v 5 Balanced Annihilation game with spectators. My cruise missile ship pounds away at a EMP Launcher, and suddenly its health goes to -1, and my EMP ships' experience level goes negative and it begins firing at an insane rate. Around 5 seconds later, the game crashes. There is a screen shot of it before the crash http://taspring.clan-sy.com/phpbb/viewforum.php?f=11 I also have a replay if you want to run it through Valgrind.
TagsNo tags attached.
Attached Files
infolog.txt (Attachment missing)
TangerineCMShipCrash.7z (Attachment missing)
Checked infolog.txt for Errors

Relationships

has duplicate 0000379 resolvedtvo 0.42b2: crash when Juno dies 

Activities

tvo

2007-01-02 10:52

reporter   ~0000505

Translated backtrace:

CompareProjDist(CProjectileHandler::projdist const&, CProjectileHandler::projdist const&)
C:/taspring_trunk/rts/Sim/Projectiles/ProjectileHandler.cpp:262

void std::__unguarded_linear_insert<__gnu_cxx::__normal_iterator<CProjectileHandler::projdist*, std::vector<CProjectileHandler::projdist, std::allocator<CProjectileHandler::projdist> > >, CProjectileHandler::projdist, int (*)(CProjectileHandler::projdist const&, CProjectileHandler::projdist const&)>(__gnu_cxx::__normal_iterator<CProjectileHandler::projdist*, std::vector<CProjectileHandler::projdist, std::allocator<CProjectileHandler::projdist> > >, CProjectileHandler::projdist, int (*)(CProjectileHandler::projdist const&, CProjectileHandler::projdist const&))
C:/taspring_trunk/C:/mingw/lib/gcc/mingw32/4.1.1/include/c++/bits/stl_algo.h:0

void std::__final_insertion_sort<__gnu_cxx::__normal_iterator<CProjectileHandler::projdist*, std::vector<CProjectileHandler::projdist, std::allocator<CProjectileHandler::projdist> > >, int (*)(CProjectileHandler::projdist const&, CProjectileHandler::projdist const&)>(__gnu_cxx::__normal_iterator<CProjectileHandler::projdist*, std::vector<CProjectileHandler::projdist, std::allocator<CProjectileHandler::projdist> > >, __gnu_cxx::__normal_iterator<CProjectileHandler::projdist*, std::vector<CProjectileHandler::projdist, std::allocator<CProjectileHandler::projdist> > >, int (*)(CProjectileHandler::projdist const&, CProjectileHandler::projdist const&))
C:/taspring_trunk/C:/mingw/lib/gcc/mingw32/4.1.1/include/c++/bits/stl_algo.h:0

CProjectileHandler::Draw(bool, bool)
C:/taspring_trunk/C:/mingw/lib/gcc/mingw32/4.1.1/include/c++/bits/stl_algo.h:2751

CAdvWater::UpdateWater(CGame*)
C:/taspring_trunk/rts/Rendering/Env/AdvWater.cpp:344

CGame::Draw()
C:/taspring_trunk/rts/Game/Game.cpp:1517

SpringApp::Update()
C:/taspring_trunk/rts/System/Main.cpp:813

SpringApp::Run(int, char**)
C:/taspring_trunk/rts/System/Main.cpp:990

Run(int, char**)
C:/taspring_trunk/rts/System/Main.cpp:1047

WinMain@16
C:/taspring_trunk/rts/System/Main.cpp:1096

main
J:/MinGW/home/Sherpya/stage/mingw-runtime-3.10/main.c:78

_mingw_CRTStartup
J:/MinGW/home/Sherpya/stage/mingw-runtime-3.10/crt1.c:226

WinMainCRTStartup
J:/MinGW/home/Sherpya/stage/mingw-runtime-3.10/crt1.c:260

el_matarife

2007-01-03 06:05

reporter   ~0000511

Uploaded the replay as a 7Zip file since Mantis FREAKS when uploading the replay normally.

tvo

2007-01-03 10:54

reporter   ~0000513

Hmm, EMP gets NaN (not a number) experience, NaN/NaN health after it hits the Warlord. After that it gets hit by the missile ship so that one gains NaN experience and NaN/NaN health too...

tvo

2007-01-03 10:57

reporter   ~0000514

If FPU exceptions are unmasked, there happen to be more bugs...

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread -1240090928 (LWP 26479)]
0x0829bce8 in CTAAirMoveType::UpdateMoveRate (this=0xb685fd8) at rts/Sim/MoveTypes/TAAirMoveType.cpp:624
624 curRate = (int)((curSpeed / maxSpeed) * 3);
(gdb) print maxSpeed
$1 = 0
(gdb) bt
#0 0x0829bce8 in CTAAirMoveType::UpdateMoveRate (this=0xb685fd8) at rts/Sim/MoveTypes/TAAirMoveType.cpp:624
#1 0x0829bdc9 in CTAAirMoveType::SlowUpdate (this=0xb685fd8) at rts/Sim/MoveTypes/TAAirMoveType.cpp:840
#2 0x082e28e9 in CUnit::SlowUpdate (this=0xb654328) at rts/Sim/Units/Unit.cpp:390
0000003 0x082c5aa3 in CUnitHandler::Update (this=0x9f34aa8) at rts/Sim/Units/UnitHandler.cpp:237
0000004 0x0817a1cf in CGame::SimFrame (this=0x89ffdf0) at rts/Game/Game.cpp:1854
0000005 0x0818a5be in CGame::ClientReadNet (this=0x89ffdf0) at rts/Game/Game.cpp:2262
#6 0x0818c3b8 in CGame::Update (this=0x89ffdf0) at rts/Game/Game.cpp:1435
#7 0x080e9d0f in SpringApp::Update (this=0xbfca8b64) at rts/System/Main.cpp:812
#8 0x080edab5 in SpringApp::Run (this=0xbfca8b64, argc=2, argv=0xbfca8c54) at rts/System/Main.cpp:990
#9 0x080eddf6 in Run (argc=2, argv=0xbfca8c54) at rts/System/Main.cpp:1047
0000010 0x080edf12 in main (argc=Cannot access memory at address 0x0
) at rts/System/Main.cpp:1087
(gdb) print curSpeed
$2 = 1.94085515

Kloot

2007-01-03 14:29

developer   ~0000515

Last edited: 2007-01-03 14:32

Hmm, maxSpeed can only be set to zero from within CMobileAI::SlowUpdate(), CMobileCAI::StopSlowGuard(), and CMobileCAI::StartSlowGuard(), but both StopSlowGuard() and StartSlowGuard() always call CTAAirMoveType::SetMaxSpeed() with the maximum speed of a unit, so that leaves only the first, which does look a bit suspicious:

    const float defMaxSpeed = owner->maxSpeed;
    const float newMaxSpeed = min(c.params[0], defMaxSpeed);
    owner->moveType->SetMaxSpeed(newMaxSpeed);

Changing the first argument of min() to c.params[0] + 1 would ensure that maxSpeed > 0 tho...

tvo

2007-01-03 14:45

reporter   ~0000516

* Fix mantis 357: The damage calculation on an underwater unit on the edge of
  an explosion of a above-water weapon with edgeEffectiveness=1 could cause
  a 0/0 divide, and hence a NaN damage and NaN experience & health for
  the firing unit. EdgeEffectiveness is clamped to below 1 to prevent this.

tvo

2007-01-03 14:46

reporter   ~0000517

@Kloot: I solved that by adding if (speed > 0) before each call to moveType->SetMaxSpeed(). You solution implicitly defines a minimum maximum speed of 1.

Issue History

Date Modified Username Field Change
2007-01-02 03:34 el_matarife New Issue
2007-01-02 03:34 el_matarife File Added: infolog.txt
2007-01-02 10:52 tvo Note Added: 0000505
2007-01-03 06:05 el_matarife File Added: TangerineCMShipCrash.7z
2007-01-03 06:05 el_matarife Note Added: 0000511
2007-01-03 10:54 tvo Note Added: 0000513
2007-01-03 10:57 tvo Note Added: 0000514
2007-01-03 14:29 Kloot Note Added: 0000515
2007-01-03 14:31 Kloot Note Edited: 0000515
2007-01-03 14:32 Kloot Note Edited: 0000515
2007-01-03 14:45 tvo Status new => resolved
2007-01-03 14:45 tvo Resolution open => fixed
2007-01-03 14:45 tvo Assigned To => tvo
2007-01-03 14:45 tvo Note Added: 0000516
2007-01-03 14:46 tvo Note Added: 0000517
2007-01-15 13:19 tvo Relationship added has duplicate 0000379