View Issue Details

IDProjectCategoryView StatusLast Update
0004892Spring engineGeneralpublic2015-07-09 15:28
Reporterhokomoko Assigned TojK  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version99.0+git 
Target Version100.0 
Summary0004892: Assertion fails in GameServer.cpp
Descriptionhttps://github.com/spring/spring/blob/develop/rts/Net/GameServer.cpp#L2569

assert(p.myState == GameParticipant::UNCONNECTED) fails when watching a demo.
Steps To ReproduceWatch the attached demo, ignore the fact it desyncs (already fixed),
In frame 17190 the assertion fails.
TagsNo tags attached.
Attached Files
assertdemo.zip (Attachment missing)
Checked infolog.txt for Errors

Activities

jK

2015-07-08 00:32

developer   ~0014935

only when watching a demo that were recorded with a spring version prior to the change

hokomoko

2015-07-08 00:39

developer   ~0014936

You could check the demo name and see it's from 99.0.1-91-g2758cb6

abma

2015-07-09 07:56

administrator   ~0014946

(i hope demotools dump shows correct info):

000000 PLAYERNAME: Playernum: 15 Name: [NC]Gretchen
000000 STARTPOS: Playernum: 15 Team: 9 Readyness: 0
017190 NETMSG_CREATE_NEWPLAYER: Playernum: 15 Spectator: 0 Team: 31 PlayerName: Seisdrum


looks weird to me, Playernum 15 is assigned twice it seems, but with different team?!

cleanrock

2015-07-09 08:10

reporter   ~0014947

Indexing mistake, do this:
+++ b/tools/DemoTool/DemoTool.cpp
@@ -361,9 +361,9 @@ void TrafficDump(CDemoReader& reader, bool trafficStats)
                                break;
                        case NETMSG_CREATE_NEWPLAYER:
                                // uchar myPlayerNum, uchar spectator, uchar teamNum, std::string playerName
- std::cout << "NETMSG_CREATE_NEWPLAYER: Playernum: " << (unsigned)buffer[1];
- std::cout << " Spectator: " << (unsigned)buffer[2];
- std::cout << " Team: " << (unsigned) buffer[3];
+ std::cout << "NETMSG_CREATE_NEWPLAYER: Playernum: " << (unsigned)buffer[3];
+ std::cout << " Spectator: " << (unsigned)buffer[4];
+ std::cout << " Team: " << (unsigned) buffer[5];
                                std::cout << " PlayerName: " << (char*) (buffer + 6);
                                std::cout << std::endl;
                                break;

And you get this:
$ ./demotool --dump -f "/home/johanr/.spring/bug_4892/20150707_221306_TartarusV7_99.0.1-91-g2758cb6 develop.sdf" | grep Seisdrum
017190 NETMSG_CREATE_NEWPLAYER: Playernum: 31 Spectator: 1 Team: 0 PlayerName: Seisdrum

abma

2015-07-09 10:00

administrator   ~0014948

meh, looks legit then. thanks! (Playernum 31 is unique)

cleanrock

2015-07-09 10:53

reporter   ~0014949

Perhaps we can use DemoFileHeader::numPlayers to avoid this problem:
int numPlayers; ///< Number of players for which stats are saved. (this contains also later joined spectators!)

cleanrock

2015-07-09 10:58

reporter   ~0014950

$ ./demotool --header -f "/home/johanr/.spring/bug_4892/20150707_221306_TartarusV7_99.0.1-91-g2758cb6 develop.sdf"
Magic: spring demofile
Version: 5
HeaderSize: 352
VersionString: 99.0.1-91-g2758cb6 develop
GameID: c4329c55c5ccd783b9da69ed40c2d64e
UnixTime: 1436299986
ScriptSize: 374502
DemoStreamSize: 2103748
GameTime: 830
WallclockTime: 975
NumPlayers: 34
PlayerStatSize: 680
PlayerStatElemSize: 20
NumTeams: 23
TeamStatSize: 104972
TeamStatElemSize: 80
TeamStatPeriod: 15

cleanrock

2015-07-09 13:30

reporter   ~0014951

DemoFileHeader::numPlayers (34) is already used but CGameServer::BindConnection selects wrong id because "Unnamed player (spec)" is found at index 31.

cleanrock

2015-07-09 13:52

reporter   ~0014952

Just to be clear, in CGameServer::BindConnection:
  size_t newPlayerNumber = players.size();
sets newPlayerNumber to 34 but for loop finds "Unnamed player (spec)" at index 31.

hokomoko

2015-07-09 15:13

developer   ~0014953

Fix ba8199b3946b3db094053e1efecd4b986dddf9ed committed to develop branch: Fix 0004892
Scan through the demo for all players added and make sure they're in the
starting script, repo: spring changeset id: 5357

jK

2015-07-09 15:28

developer   ~0014954

Fix bab30f6a335d250b3d497c9c966f44640f785897 committed to develop branch: fix 0004892: with less code, repo: spring changeset id: 5360

Issue History

Date Modified Username Field Change
2015-07-07 23:47 hokomoko New Issue
2015-07-07 23:47 hokomoko File Added: assertdemo.zip
2015-07-08 00:32 jK Note Added: 0014935
2015-07-08 00:39 hokomoko Note Added: 0014936
2015-07-09 07:56 abma Note Added: 0014946
2015-07-09 08:10 cleanrock Note Added: 0014947
2015-07-09 10:00 abma Note Added: 0014948
2015-07-09 10:53 cleanrock Note Added: 0014949
2015-07-09 10:58 cleanrock Note Added: 0014950
2015-07-09 13:30 cleanrock Note Added: 0014951
2015-07-09 13:52 cleanrock Note Added: 0014952
2015-07-09 15:13 hokomoko Changeset attached => spring develop ba8199b3
2015-07-09 15:13 hokomoko Note Added: 0014953
2015-07-09 15:13 hokomoko Assigned To => hokomoko
2015-07-09 15:13 hokomoko Status new => resolved
2015-07-09 15:13 hokomoko Resolution open => fixed
2015-07-09 15:28 jK Changeset attached => spring develop a750869a
2015-07-09 15:28 jK Changeset attached => spring develop bab30f6a
2015-07-09 15:28 jK Note Added: 0014954
2015-07-09 15:28 jK Assigned To hokomoko => jK