Random server crash, memory corruption
#1

Hello,

My server crashes once every few hours/days, i've been using crashdetect to look for problems and found that during runtime somtimes memory adresses seem to be altered:

Код:
[12:10:45] i: 5547156, j: 1234
[12:10:45] [debug] Run time error 4: "Array index out of bounds"
[12:10:45] [debug]  Attempted to read/write array element at index 5547156 in array of size 4
[12:10:45] [debug] AMX backtrace:
[12:10:45] [debug] #0 000c5aac in FunctionNodesInZone (GangID=2) at D:\Games\GTA-SA\GTA San Andreas\SA-MP 0.3.7 R2 Server\gamemodes\FRBServer0.1.pwn:13599
However, the integer used in the array could NEVER get higher then 3:

Код:
#define FCNPC_WALKNODE_LIMIT                10000
#define FCNPC_ZONE_COUNT                4

for(new j = 0; j < FCNPC_WALKNODE_LIMIT; j++)
{
        for(new i = 0; i < FCNPC_ZONE_COUNT; i++)
	{
	       if(i > 3) printf("i: %d, j: %d", i, j);
How could issues like this occur? I suppose only by memory hacking plugins?

Kind regards,
Jop
Reply
#2

Also sometimes i get the following error:

Код:
[12:46:50] [debug] Run time error 5: "Invalid memory access"
[12:46:50] [debug] AMX backtrace:
[12:46:50] [debug] #0 000c5ad4 in FunctionNodesInZone (GangID=3) at D:\Games\GTA-SA\GTA San Andreas\SA-MP 0.3.7 R2 Server\gamemodes\FRBServer0.1.pwn:13599
Reply
#3

Can you show the full function?
Reply
#4

Array index out of bounds errors cause Invalid memory access after generating a lot errors. so fix the the array problem and it will stop causing server crash.

Beginner's Guide: Single/Two/Multi-dimensional Arrays
Reply
#5

Quote:
Originally Posted by iorp
Посмотреть сообщение
Array index out of bounds errors cause Invalid memory access after generating a lot errors. so fix the the array problem and it will stop causing server crash.

Beginner's Guide: Single/Two/Multi-dimensional Arrays
As i said, the integer used to index the array can NEVER get higher than 3 in the function. But once every like million times the integer "i" gets an impossible value, i quess because of memory issues.
Reply
#6

Quote:
Originally Posted by iorp
Посмотреть сообщение
Array index out of bounds errors cause Invalid memory access after generating a lot errors. so fix the the array problem and it will stop causing server crash.

Beginner's Guide: Single/Two/Multi-dimensional Arrays
You don't need to see the rest of the function and i know all about arrays. I program a lot more than this.. Be asured that inside the function the integer "i" can NEVER be higher then 3, but every so often does get higher than it (like once a day). while the function is used multiple times per minute.
Reply
#7

What do you expect? You are using memory hacking plugins of course a problem could potentially happen! Print that variable at the end of the for loop to try and isolate the function causing the problem that way you can see if the value changes before the next iteration/after function call.

https://sampforum.blast.hk/showthread.php?tid=128338

You also need to post your problem in the FCNPC thread this has absolutely nothing to do with scripting help.
Reply
#8

Fixed the problem, i made some errors in one of my own plugins to sync thread feedback to pawn.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)