asherkin / TF2Items

Items with custom attributes.
https://forums.alliedmods.net/forumdisplay.php?f=146
32 stars 10 forks source link

Server crash randomly when giving items to Bots (any fake clients, not just TFBots) #5

Closed DBotThePony closed 6 years ago

DBotThePony commented 6 years ago

Affected plugin - FF2 Crash report - https://crash.limetech.org/nooijd4qne5v

And i see that TF2Items throw error about NULL item, but FF2 treats bots as regular players in all meanings, so ff2 should not be the reason here. And the crashes are complete random, it could and could not crash and is not stick to a specific ff2 boss, so this should be something about the bots and tf2items.

asherkin commented 6 years ago

How reproducible is this crash? Are you able to write a plugin that reproduces it reliably with just SourceMod, TF2Items, and a bot on the server?

It definitely looks like the stack is misaligned when TF2Items is calling EntityToBCompatRef, but some of that might just be Breakpad getting the stack layout wrong, would probably need to catch it in a debugger ideally. One possible cause I can see looking at the code is if TF2Items_GiveNamedItem was called before the TF2Items_OnGiveNamedItem had ever been fired, but I suspect that would fail a lot louder. It is either that or GiveNamedItem is returning something that is non-0 but also not a valid CBaseEntity.

DBotThePony commented 6 years ago

The problem that im not a sourcepawn coder - but now server crashed even without bots and on latest (dev) build of sourcemod - https://crash.limetech.org/6xpjkmzyjyhf

Do i really need to code minimal plugin with crash reproduction? If so, i need to learn something about TF2Items (im already know sourcepawn basics, but never coded on it much)

DBotThePony commented 6 years ago

Edit: Server seem to crash randomly on any code which involve ThrowNativeError(), example

Should i open up an issue in SourceMod instead?

asherkin commented 6 years ago

Execution hasn’t reached ThrowNativeError in that crash, neither in your original one. The stack pointer has been corrupted again though.

I suspect you have a plugin (or extension) with bad gamedata somewhere.

DBotThePony commented 6 years ago

I were able to stable reproduce the crash with minimal actions required on fresh sourcemod install until i killed the screen to change startup map to something vanilla. After that, im not able to reproduce crash that way anymore, investigating further

DBotThePony commented 6 years ago

After experementing around i can only conclude that different required libraries (shared objects) by installed extensions can force SourceMod to fail unpredictable. I were able to reproduce the crash by installing steamtools + steamworks extension or even just installing RCBots2 metamod source plugin, otherwise crash can be only reproduced if lucky enough.

I guess we will get much more info when most of servers will start to upgrade to newer distro packages (im on latest ubuntu server release with all latest packages installed.)

I've come to dead end i guess.

asherkin commented 6 years ago

SteamTools and SteamWorks should not be used together on the same server, but it's unlikely to cause issues like this.

I highly suspect RCBot2.

asherkin commented 6 years ago

There is nothing actionable I can do here in TF2Items so I'm going to close this issue, and I do not suspect it's an issue in SourceMod or one of your other extensions maintained by myself or others on the SourceMod team.

I suggest posting on the AlliedModders forums regarding your crash issues, but you'll likely need someone experienced in postmortem debugging to look through your crash dumps - and you should ignore people who just read the first thing on the stack trace.

DBotThePony commented 6 years ago

Many thanks anyways

DBotThePony commented 6 years ago

Since your also own Accelerator, i've found one more thing - server does not crash with RCBots enabled if server did not upload any crash dumps on startup, e.g. after crash, you clear data/dumps folder and after server startup it no longer crash. But if you did not clear data/dumps, and accelerator uploaded a crash dump, server will crash once again.