Raised This Month: $181 Target: $400

DispatchSpawn + 2^17 + sqlite = obscure crash

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Senior Member
Join Date: Mar 2014
Old 06-26-2015 , 23:25   DispatchSpawn + 2^17 + sqlite = obscure crash
Reply With Quote #1

I'm wondering if any of the back-end gurus have any ideas what causes this issue. I am working on a plugin that spawns lots of projectiles. I mean lots. It's heavily regulated and never comes close to the end-all limit of 2048 (and has a hard maximum of 1750), but projectiles are constantly being created and destroyed. I'm nearing the playable alpha stage for this mod and I did some stress testing with puppet bots, giving them logic and all.

I noticed right away that the server crashed after about 10 minutes with an unintelligible error with dbi.sqlite.ext.dll. Since I haven't added any sort of client prefs or database support to my plugin yet, this baffled me. After a bit of wasting time SHADoW pointed me to asherkin's Accelerator tool. Using that, I got this stack trace:


The important part is the crash happens with DispatchSpawn. Early on I'd figured I hit some unknown limit other than the entity limit. So I decided to have a print at every spawn, but also keep track of the number of spawns.

Both time I tested, the crash happened when trying to spawn my 131069th rocket, which is very close to 2^17. I'm guessing the other 3 were internal calls to DispatchSpawn or something.

I'm somewhat resigned to the notion I'll store rockets in an empty room (which is no problem since this mod requires specific map parameters anyway) and recycle them over and over. It wouldn't be that difficult or taxing to the CPU relative to the current level of management already present. (though always having a near-peak entity count could be a concern -- it usually stays around 400-500 with the bots going at it) What bugs me though is that it's a sourcemod extension that's crashing.

I don't know if it's logging every artificial spawn or something and then giving up at 2^17, but is there any way to disable this in code?

Alright, I finally have something substantial. Oddly the crash happens right around 2^16 DispatchSpawn calls instead of 2^17 as was happening with my plugin. I can reproduce the crash from a different module. Here's the error I get without accelerator, the one that faults sqlite:

Then here's the error I get with accelerator, which faults datacache.dll (plus the printout from the accelerator dump):

I'm attaching the .sp that will allow you to reproduce the bug. (edit note: it's in reply #6) It has dependencies so you'll need to compile it manually. I'm hoping that even though you lack the model, the bug will happen.
Fun fact, if you comment out these two lines, the bug never happens:
	SetEntProp(rocket, Prop_Send, "m_nModelIndex", DC_PROJECTILE_MODEL_INDEX);
	SetEntPropFloat(rocket, Prop_Send, "m_flModelScale", GetRandomFloat(20.0, 50.0) / DC_PROJECTILE_MODEL_RADIUS);
So what do you make of this weird situation? An obscure Valve limitation or is it some bad call that's being made to sqlite?

Last edited by sarysa; 06-27-2015 at 13:09.
sarysa is offline

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 09:47.

Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode