.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Cyborg Factory > POD-Bot mm > Bug Reports
Bug Reports Post any bug you experience with the latest release of this bot here

Closed Thread
 
Thread Tools
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#41)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 13-05-2004

Well I really need help with this bug...
If anyone know how to debug good maybe he can help...
or if anyone knows what else might be causing this error...
it could be a lot of help if you guys tell us your configurations and all..
I know absolutely that the bots do not crash on de_dust or awp_map on my computers...
btw what version source code did you use?
  
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#42)
biohazerd87
Moderator by day Waypointer by night
 
biohazerd87's Avatar
 
Status: Offline
Posts: 1,039
Join Date: Apr 2004
Location: Missouri
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 13-05-2004

How many people are you putting in the game. It seems for me the more people I put into a game the faster it will crash. Per say a game with 6 bots will probly play for 5 mins and a game with 20 bots will crash in 25 seconds.
This may or may not help but i hope it does
  
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#43)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 13-05-2004

sPlO, instead of putting your checks in pfnIndexOfEntOffset() and the likes, just #undef the INDEXENT and ENTINDEX macros and redefine them with your check included.

If you want to FIX that bug (and not PATCH it), instead of just returning from ENTINDEX when the pointer is NULL, provoke a crash here (by a zero divide, for example). This way when Windows will crash, you can click on "Debug" and the debugger will kick in right at the spot where ENTINDEX was called.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#44)
Dethpod
Member
 
Status: Offline
Posts: 32
Join Date: Dec 2003
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 13-05-2004

Gentlemen,

The "NUM_FOR_EDICT" error also happens on my linux Cs 1.5 server.

Hopefully this helps in the debug on the error:
Server Name: Test Server
Server IP : 172.21.10.175:27015
Mod : cstrike
Map : de_vegas

Last 5 lines in hlds_l.log are:
----------------------------------------------------------------------
Visibility Table out of Date. Rebuilding... (47%)
Visibility Table out of Date. Rebuilding... (53%)
Visibility Table out of Date. Rebuilding... (58%)
L 05/13/2004 - 13:25:52: FATAL ERROR (shutting down): NUM_FOR_EDICT: bad pointer
FATAL ERROR (shutting down): NUM_FOR_EDICT: bad pointer

-Dethpod
  
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#45)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 14-05-2004

NO F*ING WAY!!!
I put a divide by zero into those 2 functions...
and guess what...
it didn't work..
it just goes through as if those 2 functions aren't causing this crash....
What I had in the ENTINDEX and INDEXENT functions were:
Code:
if (FNullEnt (pEdict)) 1/0;
change pEdict to iEdictNum for INDEXENT..
it just gives me the error message.. and shuts down itself...
it doesn't crash at the divide by zero part...
We probably need someone who knows a lot about where NUM_FOR_EDICT is called

[edit]
searched around on google and found out that this error can also happen if the number of entity slots are full...
which can be caused by maps...
and I'm guessing that cs_office probably uses a LOT of entities...
maybe somehow lower the entity usage of the bot? (probably impossible)
[/edit]

Last edited by sPlOrYgOn; 14-05-2004 at 03:56..
  
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#46)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 14-05-2004

I'm not sure the code you posted actually crashes. IMO it's not executed at all because you don't assign the final value of the computation to a variable. So the compile-time optimization just scraps it and doesn't even include the "if" that's just before.

You must assign your value to a variable.

I have a function that I call in my bot code when I want to crash voluntarily the game at some point.
Code:
void TerminateOnError (const char *fmt, ...)
{
   // this function terminates the game because of an error and prints the message string
   // pointed to by fmt both in the server console and in a messagebox.
 
   va_list argptr;
   char string[1024];
 
   // concatenate all the arguments in one string
   va_start (argptr, fmt);
   vsprintf (string, fmt, argptr);
   va_end (argptr);
 
   // send the error message to console, messagebox, and also in the logfile for developers
   ServerConsole_printf ("FATAL ERROR: %s", string); // print to console
   MessageBox (0, string, "RACC - Error", NULL); // print to root-level message box
 
   // do we need to close the debug log file ?
   if (DebugLevel.fp != NULL)
	  fclose (DebugLevel.fp); // close the file
   DebugLevel.fp = NULL;
 
   // is it better to just exit or shall we crash here to help debugging ?
   if (server.developer_level > 0)
	  string[0] /= (string[0] = 0); // do a nice zero divide error for developers :)
 
   exit (1); // normal exit for non-developers (with error condition)
}
As you can see I use one variable (here the 1st element of the string array) as support for the faulty computation. I couldn't even write " / 0" because the compiler would refuse compiling and complain about a zero divide in the code. That's why I think your "breakpoint" doesn't even work.

If it does perhaps FNullEnt fails to determine the entity pointer is bad.

Every entity is supposed to have a classname. So try doing
Code:
if (STRING (pEdict->v.classname)[0] == 0)
instead of FNullEnt. If the entity pointer is bad, you will read at a forbidden memory location and provoke an access violation anyway, hence a crash, so this is in all cases what you want. And in case it wouldn't want to crash, just append your zero divide to that line.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#47)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 14-05-2004

actually what i did was this...
Code:
int bleh () { return 0; }
int blah = 0;
// then in the ENTINDEX and INDEXENT
if (FNullEnt (pEdict)) blah = 1 / bleh();
I didn't put that in the above example just to simplify the example..
Did that to stop MSVC from complaining...
so annoying...
[edit]
okay now my ENTINDEX and INDEXENT functions look like this..
Code:
inline int	  ENTINDEX(edict_t *pEdict)			{ if (STRING (pEdict->v.classname)[0] == 0); return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
inline edict_t* INDEXENT( int iEdictNum )		{ if (iEdictNum == 0) iEdictNum /= iEdictNum; return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); }
still won't make it crash...
I'm really starting to think that these 2 functions aren't causing it..
[/edit]

Last edited by sPlOrYgOn; 14-05-2004 at 07:01..
  
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#48)
[NvT]_KaszpiR_
Member
 
[NvT]_KaszpiR_'s Avatar
 
Status: Offline
Posts: 322
Join Date: Apr 2004
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 14-05-2004

PMB, does it mean that the optimization flags in makefile can causing some code corrupion and thus increasing the ability of the bug we discuss here?
  
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#49)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 14-05-2004

nope it doesn't...
I've compiled it in debug, maximum speed, and minimum size.
makes no difference.
  
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#50)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 14-05-2004

@KaszpiR: no, but if you do

if (condition)
a / b;

the result of a / b isn't fed into any variable, hence the computation is intrinsically useless for the program, hence the if condition is useless too. And I wouldn't be surprised that any decent optimizer just drops it from the code.

@Splo:
change
inline int ENTINDEX(edict_t *pEdict) { if (STRING (pEdict->v.classname)[0] == 0); return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
to
inline int ENTINDEX(edict_t *pEdict) { if (STRING (pEdict->v.classname)[0] == 0) blah=1/bleh(); return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }

And since 0 divided by anything oughta be 0, I'm not sure the optimizer doesn't even execute this:
if (iEdictNum == 0) iEdictNum /= iEdictNum;
Same problem. MAKE SURE your code will be executed.

When you say it doesn't make it crash, the point is not to MAKE it crash or not, the point is to land into the debugger when it does (because it does crash already).



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com