Fix and point out several handle leaks #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?