Server crashing on vehicle spawn
#1

Hi everyone,

I've been attempting to debug this issue for the past few weeks to no avail, and I am honestly confused on what could be causing this.

Here is my respawn code

PHP код:
forward OwnedVehicleRespawn(vehicleid);
public 
OwnedVehicleRespawn(vehicleid)
{
    print(
"[DEBUG] OwnedVehicleRespawn");
    
    
VehicleInfo[vehicleid][vehicleID] = CreateVehicle(VehicleInfo[vehicleid][vModelID], VehicleInfo[vehicleid][vX], VehicleInfo[vehicleid][vY], VehicleInfo[vehicleid][vZ], VehicleInfo[vehicleid][vAngle], VehicleInfo[vehicleid][vColor1], VehicleInfo[vehicleid][vColor2], 36000);
    
ModVehicle(VehicleInfo[vehicleid][vehicleID]);
    
    
printf("[DEBUG] Vehicle to respawn: %i"VehicleInfo[vehicleid][vehicleID]);
    
    new 
count;
    for(new 
iMAX_VEHICLESi++)
    {
        if(
IsValidVehicle(i)) count++;
    }
 
    
printf("[DEBUG] * There are %d valid spawned vehicles on this server."count);
    print(
"[DEBUG] OwnedVehicleRespawn Finished");
    
    return 
1;

This will work perfectly for an undefined amount of time. Sometimes it can be an hour, sometimes two days. I am confident that the cause of these crashes is due to our owned vehicles respawning, though the question is, how and where?

Here's the output from my debug.

PHP код:
[21:29:09OnVehicleDeath
[21:29:09Destroyed id 276
[21:29:09OwnedVehicleRespawn
[21:29:09] NEW DEBUG --- Vehicle to respawn ID276 AND its variable ID651 --- DB ID651
[21:29:09] * There are 285 valid spawned vehicles on this server.
[
21:29:09OwnedVehicleRespawn Finished
[21:29:09] [debugServer crashed due to an unknown error
[21:29:09] [debugNative backtrace:
[
21:29:09] [debug#0 aa6dae8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[21:29:09] [debug#1 aa6d3bcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[21:29:09] [debug#2 aa6d4dbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[21:29:09] [debug#3 aa6d5226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[21:29:09] [debug#4 aa6daadc in ?? () from plugins/crashdetect.so
[21:29:09] [debug#5 ab740410 in ?? ()
[21:29:09] [debug#6 ab740430 in ?? ()
[21:29:09] [debug#7 ab478871 in gsignal () from /lib/libc.so.6
[21:29:09] [debug#8 ab47a14a in abort () from /lib/libc.so.6
[21:29:09] [debug#9 ab4b8735 in ?? () from /lib/libc.so.6
[21:29:09] [debug#10 ab4beb91 in ?? () from /lib/libc.so.6
[21:29:09] [debug#11 ab4c12f8 in ?? () from /lib/libc.so.6
[21:29:09] [debug#12 ab6d9df2 in _ZdlPv () from /usr/lib/libstdc++.so.6
[21:29:09] [debug#13 ab6d9e4e in _ZdaPv () from /usr/lib/libstdc++.so.6
[21:29:09] [debug#14 0807fbf8 in ?? () from ./samp03svr
[21:29:09] [debug#15 0808013d in ?? () from ./samp03svr
[21:29:09] [debug#16 08074c3a in ?? () from ./samp03svr
[21:29:09] [debug#17 080763fe in ?? () from ./samp03svr
[21:29:09] [debug#18 ab71eb39 in ?? () from /lib/libpthread.so.0
[21:29:09] [debug#19 ab530c1e in clone () from /lib/libc.so.6 
As you can see "OwnedVehicleRespawn Finished" gets printed and then suddenly, the server crashes. The vehicle does not appear to actually be created as there is no print from OnVehicleSpawn? (Some debug text has changed, but the code is the same)

PHP код:
public OnVehicleSpawn(vehicleid)
{
    
printf("Vehicle %i spawned!",vehicleid);
    return 
1;

OnVehicleDeath is as follows

PHP код:
public OnVehicleDeath(vehicleidkillerid)
{
    print(
"OnVehicleDeath");
    for(new 
iMAX_SAVED_VEHICLESi++)
    {
        if (
vehicleid != VehicleInfo[i][vehicleID]) continue;
        
        if (
DestroyVehicle(vehicleid))
        {
            
printf("Destroyed id %i"vehicleid);
            
OwnedVehicleRespawn(i);
        }
        else
        {
            
printf("The vehicle %i was not destroyed"vehicleid);
        }
        
        break;
    }

If anyone can assist with this I would be grateful, if there is any additional debug I can add then I'm happy to do that and share the results. This issue has existed for far too long now, but I cannot for the life of me understand why.

Edit: We've already tested the mod code, the crash is unrelated to applying vehicle modifications.

Thanks
Reply
#2

Could you try to make the system debug the vehicle IDs. perhaps it's only for a given ID that the system crashes. If you can trace what car ( as I assume it's just one ) or ID is bugging you up, you might be able to trace the problem back into that.
Reply
#3

Quote:
Originally Posted by SaltySandy
Посмотреть сообщение
Could you try to make the system debug the vehicle IDs. perhaps it's only for a given ID that the system crashes. If you can trace what car ( as I assume it's just one ) or ID is bugging you up, you might be able to trace the problem back into that.
Thanks for your reply bud, I've attempted that in the past.

PHP код:
NEW DEBUG --- Vehicle to respawn ID276 AND its variable ID651 --- DB ID651 
The database ID on this vehicle is 651, as far as I know this is not absolute. I will confirm if it happens again but I don't think this is related to a specific ID unfortunately.
Reply
#4

Quote:
Originally Posted by DanLore
Посмотреть сообщение
Thanks for your reply bud, I've attempted that in the past.

PHP код:
NEW DEBUG --- Vehicle to respawn ID276 AND its variable ID651 --- DB ID651 
The database ID on this vehicle is 651, as far as I know this is not absolute. I will confirm if it happens again but I don't think this is related to a specific ID unfortunately.
Sorry lad, I totally forgot to read the first block with the error log in it ( silly me... )
Judging by the errors, it is triggered after the OwnedVehicleRespawn is triggered ( as you stated ). The ID's are not bugging around. Are you postive the plugin CrashDetect is not interfering with a process from this function? I'm not very familiar with it, as I've never really used it.
Reply
#5

Do you mean if crash detect is causing a crash? I've been trying everything I can think of for months now, the crash occurs with or without crash detect enabled. Doesn't appear to be related and nothing else is using these callbacks, but I will double check that now just in-case.
Reply
#6

Just something that popped in my mind.. Could you quickly run the command 'top' via SSH to see the use of the server? It could be that the function tries to use up too much memory triggering a safery feature, shutting down other bits of the server?
Reply
#7

For some reason, there are two instances of the server running, I'm guessing that could be a potential cause of bugs/glitches - I'll get that sorted and see if the crashes occur with only one instance running.

Quote:

Mem: 16614660k total, 9488936k used, 7125724k free, 190412k buffers
Swap: 1046520k total, 0k used, 1046520k free, 8614772k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21952 sart 20 0 134m 81m 3484 S 4.7 0.5 6:59.38 samp03svr
2747 sart 20 0 180m 127m 3508 S 0.3 0.8 139:23.90 samp03svr

Reply
#8

Quote:
Originally Posted by DanLore
Посмотреть сообщение
For some reason, there are two instances of the server running, I'm guessing that could be a potential cause of bugs/glitches - I'll get that sorted and see if the crashes occur with only one instance running.
Alright.. Drop a PM if you find anything, as I won't be reading this thread anymore!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)