ERROR: idGameLocal::EnsureAlloced State Received For Entity With No Header


(-RedFox-) #1

After moving to a different continent (again!) and digging up my old stuff I want to continue working on a “mod” I’ve been working on. And I am running into the same problem I had before: windows clients won’t connect to the linux dedicated server. To be exact, windows clients will connect and start loading the server but then spit at me:


Loaded map in     2 seconds
Current Entity (Broadcast)
=======================================
Current Time: 1315512
Entity Number: 334
No Information Found
Previous Entity To Blame (Broadcast)
=======================================
Current Time: 1315512
Entity Number: 0
Created At: 1315479
Type: idPlayer
Name: 
--------- Game Map Shutdown ----------
--------------------------------------
********************
ERROR: idGameLocal::EnsureAlloced State Received For Entity With No Header

The linux client (on the same computer as the windows one using dual boot) connects just fine to the server and does what it is supposed to do.

At first I thought that there was something wrong with the custom map (that uses the "mod
"'s functionality) but when I loaded area22 on the server and tried to connect to it with the windows client the game crashed right after spawning 100% of the entities. Gonna boot into linux after I post this and try the linux client, but I think that will work. So I guess there must be a bug somewhere in my code. Very strange that it only occurs under windows though.

Anyway, if anyone has some insight into this error, it would be much, much appreciated!

/RedFox


(-RedFox-) #2

The linux client crashed as well, so that test doesn’t say much. Really don’t know where too look, to be honest…


(TinMan) #3

Short:
You’re corrupting the network state somewhere, you have to be careful your read and writes to the networkstate are equivalent.

Long:
It says right there the idPlayer is the likely culprit, corroborated by the fact it’s saying the entity number it’s looking for is 334, if the previous entity was 0, the next should be the next number, so entity 1 (or in this case if there’s no other clients entity 32).

So, there’s some data that was written to the entity state but not read, therefore when it tries to read the next entity number from the snapshot it’s pulling some of that data and in this case -fortunately- getting a number for an entity that doesn’t exist, thus giving a nice indication of what the problem is.

Take a fine toothed comb through idPlayer::WriteNetworkState, idPlayer::ReadNetworkState and see what you’ve done.


(-RedFox-) #4

Thanks a lot for the explanation! I will have a good look at it.

Though to be honest, I didn’t change those functions (at least I shouldn’t have =] ). I have added two functions (a “real” function and an Event_ function) and an int variable to the idPlayer class and two boolean variables to the playerFlags structure. But I will have a good look at the whole class and see what changes exactly I have made. I knew it was a good idea to put all my changes between commentary tags =]

By the way, the only communication I have implemented between server and client is one sdReliableServerMessage.


(-RedFox-) #5

Some updated info:

– A linux client connects correctly to a linux server and a windows client connects correctly to a windows server.
– Connecting a windows client to a linux server generates the above mentioned error: ERROR: idGameLocal::EnsureAlloced State Received For Entity With No Header
– Connecting a linux client to a windows server generates the following error: ERROR: Network State Corrupted: game/Player.cpp (12092)
– Looking through the code TinMan mentioned as well as the line in Player.cpp mentioned above, they both point toward game/network/SnapshotState.h, to be specific sdEntityStateNetworkData::GetData
– The implementation of which depends on whether SAFE_STATE_CONVERSION is defined or not. And SAFE_STATE_CONVERSION is not defined in the code (it’s commented out), but I did find reference to it in the windows binaries, so I think it might be set as a compiler option.
– I’m now rebuilding both the windows and linux binaries with SAFE_STATE_CONVERSION explicitly defined in the code and will see what happens.
– The only weird thing is that someone should have noticed this issue before me, when building windows and linux binaries. So I am not convinced yet.


(-RedFox-) #6

Of course that wasn’t it. For completeness, game/Player.cpp (12092) is the first ASYNC_SECURITY_READ( msg ) in idPlayer::ReadPlayerStateBroadcast

ASYNC_SECURITY_READ is defined in game/Common.h as:
#ifndef SD_PUBLIC_BUILD
#define ASYNC_SECURITY
#endif // SD_PUBLIC_BUILD

#ifdef ASYNC_SECURITY

#define ASYNC_SECURITY_READ( STREAM )
if ( STREAM.ReadLong() != ASYNC_MAGIC_NUMBER ) {
gameLocal.Error( “Network State Corrupted: %s(%d)”, FILE, LINE );
}

#define ASYNC_SECURITY_WRITE( STREAM )
STREAM.WriteLong( ASYNC_MAGIC_NUMBER );

#else
#define ASYNC_SECURITY_READ( STREAM )
#define ASYNC_SECURITY_WRITE( STREAM )
#endif // ASYNC_SECURITY

Since the linux client spews out the error message, ASYNC_SECURITY and therefore SD_PUBLIC_BUILD must be defined somewhere. Although I can’t find where.

In VS2005, the Release configuration includes the SDK Property Sheet, which defines SD_SDK_BUILD and SD_PUBLIC_BUILD, that that must have defined ASYNC_SECURITY too.

I’m going back to Player.cpp, but I really don’t understand why linux and windows build would be different. Maybe I will a completely clean (i.e. no edits) of the game on both operating systems and see what happens.


(-RedFox-) #7

From http://www.modwiki.net/wiki/How_to_build_the_SDK_on_Windows

You will need to add the following lines to ‘SDK 1.5/source/framework/BuildDefines.inc’:


   #ifndef SD_PUBLIC_BUILD
           #define SD_PUBLIC_BUILD
   #endif

Without this, odd bugs will occur when running your code, even if it is unmodified from the base SDK code.

Strange thing is that it looks like I have modified the BuildDefines.inc in the past, because I have BuildDefines.inc.bak, but I must have revert the edit, because BuildDefines.inc doesn’t have anything in it anymore.

Anyway, I hope this is the problem. I’ll let you know if it works out.


(-RedFox-) #8

Okay, that wasn’t the problem, as I said before, SD_PUBLIC_BUILD is already defined in the VS2005 Property Sheet. It also shows a warning saying it is already defined.

I did a completely new build of a fresh copy of the source on both windows and linux, and while connecting the linux client to a windows server, it throws exactly the same error in Player.cpp: the first ASYNC_SECURITY_READ( msg ) in idPlayer::ReadPlayerStateBroadcast.

So it must be something about the way I do my builds. I will make a new post with all the relevant data.


(-RedFox-) #9

With a lot of help from timestart I can now build under 64bit linux and somehow that solved the problem. I can’t say I understand how and why, but I’m quite happy. =]


(light_sh4v0r) #10

Timestart is somehow doing all this stuff noone else knows anything about at all like it’s common knowledge :rolleyes:


(ballking) #11

I have added two functions (a “real” function and an Event_ function) and an int variable to the idPlayer class and two boolean variables to the playerFlags structure. But I will have a good look at the whole class and see what changes exactly I have made.