alongubkin/store — pull request #18 by peace-maker (2014-12-28 11:44:55+00:00)
Title: Fix and point out several handle leaks

The store-backend was unloaded due to lots of open handles.
L 12/26/2014 - 18:46:06: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store\store-backend.smx")
L 12/26/2014 - 18:46:06: [SM] Unloading plugin to free 14756 handles.
L 12/26/2014 - 18:46:06: [SM] Contact the author(s) of this plugin to correct this error.
L 12/26/2014 - 18:46:06: --------------------------------------------------------------------------
L 12/26/2014 - 18:46:06: TypeIDatabase |Count7413
L 12/26/2014 - 18:46:06: TypeDataPack |Count7340
L 12/26/2014 - 18:46:06: TypeGlobalFwd |Count3
L 12/26/2014 - 18:46:06: -- Approximately 96 bytes of memory are in use by (14756) Handles.

I doubt the fixes in this PR really avoid all the leaks. I've pointed out several places in the code which still leak handles but require changes to the API. The backend callbacks should really be called when the query failed too. With some "success" boolean set to false or 0 data being returned.

All the plugins that use the backend and pass a handle through the any:data callback leak that handle if the query of the method in question fails.

All the open IDatabase handles are threaded queries. A possible cause could be the database connection going away and the plugin firing far too many queries. The DBI system can't process them fast enough, so they stack up. Maybe add some more caching or use the cache more often?