ziggi / FCNPC

FCNPC - Fully Controllable NPC
Apache License 2.0
125 stars 30 forks source link

Server crashes randomly (FCNPC 2.0.9, SA:MP 0.3.7 R2, Ubuntu 22.04). #317

Closed Sesomsoma closed 2 months ago

Sesomsoma commented 2 months ago

Describe the bug My server crashes randomly for no reason. CrashDetect doesn't say anything, I've already set other plugins. I'm starting to think it's FCNPC (it's also the only one that leaves logs).

To Reproduce There is no way to reproduce it, it happens randomly

FCNPC Log

=========================== FCNPC Exception Handler ============================
Signal 11 (Segmentation fault), address is 58 from f3ee0e33

Backtrace:
  #0 in plugins/fcnpc-209.so(_ZN17CExceptionHandler24ExceptionHandlerCallbackEiP9siginfo_tPv+0x126) [0xf3c77ba6]
  #1 in linux-gate.so.1(__kernel_rt_sigreturn+0) [0xf47905a0]
  #2 in plugins/raknet.so(_ZN6Script10ExecPublicERKSt10shared_ptrIN3ptl6PublicEEihP9BitStream+0x23) [0xf3ee0e33]
  #3 in plugins/raknet.so(_ZNSt17_Function_handlerIFbRKSt10shared_ptrI6ScriptEEZN6Plugin7OnEventIL12PR_EventType4EEEbihP9BitStreamEUlS4_E_E9_M_invokeERKSt9_Any_dataS4_+0x38) [0xf3eeb2a8]
  #4 in plugins/raknet.so(_ZN14MessageHandler9OnReceiveEP16RakPeerInterfaceP6Packet+0x17c) [0xf3ee816c]
  #5 in ./samp03svr() [0x806f969]
  #6 in ./samp03svr() [0x8071d73]
  #7 in ./samp03svr() [0x807bc50]
  #8 in plugins/raknet.so(_ZN5Hooks18RakServer__ReceiveEPv+0xa2) [0xf3ee7442]
  #9 in ./samp03svr() [0x80aed3d]

Information:
  System: GNU/Linux
  SA-MP: 0.3.7 R2
  FCNPC: 2.0.9

Functions:
  FUNC_CPlayerPool__DeletePlayer: 0x80d0a90
  FUNC_CPlayer__Kill: 0x80cb220
  FUNC_CPlayer__EnterVehicle: 0x80cc1c0
  FUNC_CPlayer__ExitVehicle: 0x80cc340
  FUNC_CPlayer__SpawnForWorld: 0x80ccfc0
  FUNC_GetVehicleModelInfo: 0x80d5e00
  FUNC_CConsole__GetIntVariable: 0x80a0070
  FUNC_ClientJoin_RPC: 0x80b0030

Pointers:
  VAR_ServerAuthentication: 0x81ab8ec
  VAR_NetVersion: 0xfd9

Offsets:
  OFFSET_RemoteSystemManager: 0x334
  OFFSET_RemoteSystemSize: 0xc69
  OFFSET_RemoteSystem__ConnectMode: 0xc62
  OFFSET_RemoteSystem__Unknown: 0xc67
=========================== FCNPC Exception Handler ============================

Versions:

I'm dealing with this error for months now. From time to time my server goes down. I use the latest version of FCNPC and my plugins are:

discordconnector, gps, PawnRakNet, PawnCMD, streamer sscanf, bcrypt mysql

ziggi commented 2 months ago

Just look at the backtrace, it points to raknet.

Sesomsoma commented 1 month ago

Hello. The problem above did have to do with RakNet. Now, a few weeks ago, I'm dealing with random crashes that happen only if I have FCNPC connected. I have no way to reproduce this crash, it seems to appear randomly during the day.

I think it's a bug of the plugin (or bad practice of mine).

Maybe we can refresh our minds together, I publish the latest FCNPC log here (CrashDetect leaves no trace, if I disconnect CrashDetect FNPC points to streamer.so, if I disconnect streamer.so, the FCNPC log leads to the last plugin in the list “plugins ", whatever it is):

=========================== FCNPC Exception Handler ============================
Signal 11 (Segmentation fault), address is 0 from f7a85c01

Backtrace:
  #0 in plugins/fcnpc.so(_ZN17CExceptionHandler24ExceptionHandlerCallbackEiP9siginfo_tPv+0x126) [0xf776aba6]
  #1 in linux-gate.so.1(__kernel_rt_sigreturn+0) [0xf7f5a570]
  #2 in /lib/i386-linux-gnu/libc.so.6(+0xb5c01) [0xf7a85c01]
  #3 in ./samp03svr() [0x809e172]
  #4 in ./samp03svr() [0x80950e4]
  #5 in plugins/@CRASHDETECT.so(_ZN11CrashDetect10OnCallbackEiPiS0_+0x478) [0xf795e168]
  #6 in plugins/@CRASHDETECT.so(+0x202ab) [0xf79612ab]
  #7 in plugins/@PROFILER.so(_ZN15ProfilerHandler8CallbackEiPiS0_+0x74) [0xf7927214]
  #8 in plugins/@PROFILER.so(+0x12012) [0xf7926012]
  #9 in plugins/@CRASHDETECT.so(amx_Exec+0x1739) [0xf7965b59]

Information:
  System: GNU/Linux
  SA-MP: 0.3.7 R2
  FCNPC: 2.0.8

Functions:
  FUNC_CPlayerPool__DeletePlayer: 0x80d0a90
  FUNC_CPlayer__Kill: 0x80cb220
  FUNC_CPlayer__EnterVehicle: 0x80cc1c0
  FUNC_CPlayer__ExitVehicle: 0x80cc340
  FUNC_CPlayer__SpawnForWorld: 0x80ccfc0
  FUNC_GetVehicleModelInfo: 0x80d5d30
  FUNC_CConsole__GetIntVariable: 0x80a0070
  FUNC_ClientJoin_RPC: 0x80b0030

Pointers:
  VAR_ServerAuthentication: 0x81aa8a8
  VAR_NetVersion: 0xfd9

Offsets:
  OFFSET_RemoteSystemManager: 0x334
  OFFSET_RemoteSystemSize: 0xc69
  OFFSET_RemoteSystem__ConnectMode: 0xc62
  OFFSET_RemoteSystem__Unknown: 0xc67
=========================== FCNPC Exception Handler ============================

0x809e172 and 0x80950e4 ¿?

ziggi commented 1 month ago

0x80950e4 points at calling native function in amx_Callback function 0x809e172 points at calling memmove in n_memcpy function

So the problem is somewhere in some callback. Try to check memcpy calls in your script. That's all we can get with this information. Log each callback call at the beginning and at the end (you can do it with samp-log plugin).

Sesomsoma commented 1 month ago

0x80950e4 points at calling native function in amx_Callback function 0x809e172 points at calling memmove in n_memcpy function

So the problem is somewhere in some callback. Try to check memcpy calls in your script. That's all we can get with this information. Log each callback call at the beginning and at the end (you can do it with samp-log plugin).

Thank you, you enlightened me. I'll check as soon as I can.

For people who can read (so we can contribute to anyone who has a similar problem):

I think it may be the YSI library, it may be generating some type of problem with the FCNPC drivers and their VehicleOccupant iterator.

ziggi commented 1 month ago

Yes, YSI do a lot of memory related things that no one understands.