Zeex / samp-plugin-profiler

Performance profiler plugin for SA-MP server
http://forum.sa-mp.com/showthread.php?t=271129
BSD 2-Clause "Simplified" License
46 stars 8 forks source link

not getting any data / crash with profiler plugin #16

Open JernejL opened 9 years ago

JernejL commented 9 years ago
  1. streamer is up to date, so are almost all plugins except the mysql one.

plugins line:

plugins crashdetect MapAndreas streamer mysql profiler TranslationPlugin MathPlugin rwthread socket gvar PlayerDataRecorder KeyVal QIterator nativechecker

Plugin initialization:

v0.3z-R4, (C)2005-2014 SA-MP Team

[22:21:42] [22:21:42] Server Plugins [22:21:42] -------------- [22:21:42] Loading plugin: crashdetect [22:21:42] CrashDetect v4.15 is OK. [22:21:42] Loaded. [22:21:42] Loading plugin: MapAndreas [22:21:42] Loaded. [22:21:42] Loading plugin: streamer [22:21:42]

* Streamer Plugin v2.7.5.2 by Incognito loaded *

[22:21:42] Loaded. [22:21:42] Loading plugin: mysql [22:21:42] >> plugin.mysql: R35 successfully loaded. [22:21:42] Loaded. [22:21:42] Loading plugin: profiler [22:21:42] Profiler v2.12.1 is OK. [22:21:42] Loaded. [22:21:42] Loading plugin: TranslationPlugin [22:21:42] Translations plugin loaded. [22:21:42] Loaded. [22:21:42] Loading plugin: MathPlugin [22:21:42] Math Plugin Loaded. [22:21:42] Loaded. [22:21:42] Loading plugin: rwthread [22:21:42] Threaded Read/Write/Execute plugin loaded. [22:21:42] Loaded. [22:21:42] Loading plugin: socket [22:21:42] Socket plugin v0.2b loaded. [22:21:42] Loaded. [22:21:42] Loading plugin: gvar [22:21:42]

* GVar Plugin v1.3 by Incognito loaded *

[22:21:42] Loaded. [22:21:42] Loading plugin: PlayerDataRecorder [22:21:42] Player Data Recorder version 1.1.5 loaded. Created 500 player instances. [22:21:42] Loaded. [22:21:42] Loading plugin: KeyVal [22:21:42] KeyVal version 1.2.0 loaded. [22:21:42] Loaded. [22:21:42] Loading plugin: QIterator [22:21:42] QIterator version 1.0.2 loaded. [22:21:42] Loaded. [22:21:42] Loading plugin: nativechecker [22:21:42] Loaded. [22:21:42] Loaded 14 plugins.

profiler attach = ok:

[22:21:42] [profiler] Attached profiler to gamemodes/PartyGM.amx

crash:

[22:21:50] [debug] #0 6c9191f2 in ?? () from plugins\profiler.DLL [22:21:50] [debug] #1 6c919a6c in ?? () from plugins\profiler.DLL [22:21:50] [debug] #2 6c91198e in ?? () from plugins\profiler.DLL [22:21:50] [debug] #3 6c914e0a in ?? () from plugins\profiler.DLL [22:21:50] [debug] #4 5f92a650 in ?? () from plugins\mysql.DLL [22:21:50] [debug] #5 004693c6 in ?? () from samp-server.exe [22:21:50] [debug] #6 0048816b in ?? () from samp-server.exe [22:21:50] [debug] #7 00496ca1 in ?? () from samp-server.exe [22:21:50] [debug] #8 00496cb1 in ?? () from samp-server.exe

With a earlier version of streamer the server did not crash but it also did not output any data (blank files).

i'm also availible on irc as always - nick JernejL_Work

Zeex commented 9 years ago

Can you build profiler with debug symbols and run it under a debugger (WinDbg or Visual Studio)? That would give more much information.

JernejL commented 9 years ago

I'm not sure how to build it, i have visual studio 2008 and i will try, but it would probably go faster if you can make me a debug build then i can run it.

Zeex commented 9 years ago

Here is a debug build of profiler:

https://ci.appveyor.com/project/Zeex/samp-plugin-profiler/build/8/artifacts

With the pdb file crashdetect should be able to tell function names in the backtrace, you'll need to put profiler.pdb to plugins or your server folder, or copy to both to be sure.

It may still be required to run the server under a debugger though, so doing that now may save us some time. Visual Studio 2008 should work I guess, if not there's WinDbg:

https://msdn.microsoft.com/en-us/windows/hardware/hh852365.aspx

JernejL commented 9 years ago

It might be related to same issue as here? https://github.com/Zeex/sampgdk/issues/138

Here's the message that crashes it - debugged:


Microsoft Visual C++ Runtime Library

Assertion failed!

Program: ... File: profiler.cpp Line: 170

Expression: callgraph.root() != callgraph.sentinel()

For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application - JIT must be enabled)

Abort Retry Ignore

after i hit retry i get this call stack in msvc.:

msvcr100d.dll!529df1a4()
[Frames below may be incorrect and/or missing, no symbols loaded for msvcr100d.dll] msvcr120.dll!5276ee1f()
mysql.dll!52722957()
profiler.dll!amxprof::Profiler::LeaveFunction(int address=0) Line 170 + 0x33 bytes C++ profiler.dll!amxprof::Profiler::DebugHook(int (tagAMX ) debug=0x52b86270) Line 74 C++ profiler.dll!Profiler::Debug() Line 190 + 0x12 bytes C++ profiler.dll!amx_Debug_Profiler(tagAMX * amx=0x01edff68) Line 41 C++ crashdetect.dll!amxExec(tagAMX * amx=0xffffffff, int * retval=0x0018fe00, int index=122) Line 3581 + 0x9 bytes C crashdetect.dll!CrashDetect::DoAmxExec(int * retval=0x0018fe00, int index=122) Line 233 + 0xd bytes C++ crashdetect.dll!AmxExec(tagAMX * amx=0x01edff68, int * retval=0x0018fe00, int index=122) Line 54 C++ profiler.dll!amxprof::Profiler::ExecHook(int * retval=0x0018fe00, int index=122, int (tagAMX , int , int)_ exec=0x52ae21ee) Line 123 + 0x13 bytes C++ profiler.dll!Profiler::Exec(int * retval=0x0018fe00, int index=122) Line 219 + 0x18 bytes C++ profiler.dll!amx_Exec_Profiler(tagAMX * amx=0x01edff68, int \ retval=0x0018fe00, int index=122) Line 59 C++ streamer.dll!52bd51a7()
samp-server.exe!0046ea94()
samp-server.exe!00488d1b()
samp-server.exe!004a68a8()
samp-server.exe!00496ca1()
samp-server.exe!00496cb1()
samp-server.exe!004a6821()
samp-server.exe!00498352()
kernel32.dll!7699338a()
ntdll.dll!77e99f72()
ntdll.dll!77e99f45()

Zeex commented 9 years ago

Ah, it's call graph again... This probably is the most buggy part of the plugin. Disabling it should help I guess, although that's not a solution. I'll see if I can fix it.

JernejL commented 9 years ago

Edited.. misinterpreted - i didn't realise that was a option already. now using call_graph 0, will see if it works.

JernejL commented 9 years ago

Tried without call graph, no crash now but server doesn't function. mysql plugin doesn't seem to trigger callback and some data isn't loaded which leads to a pawn crash. i'll try updating mysql plugin.

JernejL commented 9 years ago

plugin.mysql: R39-3 successfully loaded.

Nope.. still no callback, something dies and server doesn't function :(

JernejL commented 9 years ago

I've upgraded every plugin possible, newest streamer, updated mathplugin and latest crashdetect.

I use call graph 0 and still get no data on linux and windows, please help if possible because i have a very serious performance issue on the server and i am unable to track it down.

Zeex commented 9 years ago

Have you tried some older version of profiler? Perhaps I added some bug in latest ones. If changing the order of plugins doesn't help I'm really out of ideas...

JernejL commented 9 years ago

I got a working combination now:

[16:09:17] Socket plugin v0.2b loaded. [16:09:17] >> plugin.mysql: R39-3 successfully loaded. [16:09:17] CrashDetect v4.15.1 is OK. * Streamer Plugin v2.7.5.2 by Incognito loaded * [16:09:17] Profiler v2.12.1 is OK.

Mathplugin is still on older version of sampgdk - i still haven't gotten to compile it.. :(

I'm finally getting data and couldn't be happier, i'm finally seeing what is slow in script.

But i have a suggestion, i will open a ticket if you think this is a good idea - to add another native, one which clears the data.

So basically, i can clear the date each 5 minutes, and then when i detect low server fps / ticks i can dump the profiler data automaticly.