Raised This Month: $158 Target: $400
 39% 

Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]


Post New Thread Reply   
 
Thread Tools Display Modes
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 12-15-2018 , 02:43   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #281

Looks like a plugin is trying to access an object that is alreasy dusposed.

Can you provide the code in the Event_PlayerDeath event callback?
__________________
Neuro Toxin is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 12-24-2018 , 00:55   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #282

Quote:
Originally Posted by Neuro Toxin View Post
Looks like a plugin is trying to access an object that is alreasy dusposed.

Can you provide the code in the Event_PlayerDeath event callback?
They PM'd me. I believe it may be an error on my end.

In Event_PlayerDeath (and round end for those still alive), I was combining stats from multiple dynamic objects held in an ArrayList, I was removing/disposing one each time they were combined. In doing so, I didnt have the .IsValid check and thought I was fine without it by tracking how many cells the array had, using the .Erase function (shifting it), and going in reverse order. Somewhere, my logic has a scenario the leads to an invalid object. My fix for now is the .IsValid check. Am waiting to hear back from the poster regarding whether or not the issue is resolved, but I dont believe the error involves dynamic.

To make it more confusing for me, I had a memory leak (now patched) in that I forgot to dispose the objects being removed from the arraylist when they were combined. I was only disposing dynamic objects on next round start. That said, it is strange that an object was already disposed if there was no disposing until after all the processing was done...Is there not multiple seconds between round end/start events (during which all processing should be complete, so all objects should have still been valid)? I suppose I should test that assumption. That said, assuming there is time between those events, I dont understand how any dynamic object being processed could be already disposed. I can send you my code if needed. The .inc file was auto-generated from your tool.

EDIT: .IsValid causes other errors. Plugin is now recoded without Dynamic and all errors are gone.
__________________

Last edited by ThatOneGuy; 12-25-2018 at 13:20.
ThatOneGuy is offline
Muhlex
Junior Member
Join Date: Mar 2019
Old 05-12-2019 , 11:01   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #283

I am currently trying to implement Dynamic into a series of plugins, simply for allowing easy access to data tied to clients for each plugin. Thus I am trying to use the static player settings object. This seems to work so far, however the data is not cleared when a client disconnects.

The wiki mentions that "Player Settings members are reset during Sourcemod's OnClientDisconnect_Post forward". Contrary to that, set values persist for the clients, even after rejoining the server.

Looking at the plugin code of dynamic.sp, this seems to be due to the OnClientDisconnect_Post forward not using public, but being declared as stock instead.

PHP Code:
stock void OnClientDisconnect_Post(int client)
{
    
_Dynamic_ResetObject(client);

I am still an amateur at Sourcepawn so I might have completely missed something obvious here.
Muhlex is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-12-2019 , 19:48   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #284

Quote:
Originally Posted by ThatOneGuy View Post
They PM'd me. I believe it may be an error on my end.

In Event_PlayerDeath (and round end for those still alive), I was combining stats from multiple dynamic objects held in an ArrayList, I was removing/disposing one each time they were combined. In doing so, I didnt have the .IsValid check and thought I was fine without it by tracking how many cells the array had, using the .Erase function (shifting it), and going in reverse order. Somewhere, my logic has a scenario the leads to an invalid object. My fix for now is the .IsValid check. Am waiting to hear back from the poster regarding whether or not the issue is resolved, but I dont believe the error involves dynamic.

To make it more confusing for me, I had a memory leak (now patched) in that I forgot to dispose the objects being removed from the arraylist when they were combined. I was only disposing dynamic objects on next round start. That said, it is strange that an object was already disposed if there was no disposing until after all the processing was done...Is there not multiple seconds between round end/start events (during which all processing should be complete, so all objects should have still been valid)? I suppose I should test that assumption. That said, assuming there is time between those events, I dont understand how any dynamic object being processed could be already disposed. I can send you my code if needed. The .inc file was auto-generated from your tool.

EDIT: .IsValid causes other errors. Plugin is now recoded without Dynamic and all errors are gone.
.Dispose has a parameter disposemembers which defaults to true. This disposes Dynamic member types and deletes Handle member types.

It sounds like they had been referencing the disposed object elsewhere which was being disposed by its parent.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-12-2019 , 19:50   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #285

Quote:
Originally Posted by Muhlex View Post
I am currently trying to implement Dynamic into a series of plugins, simply for allowing easy access to data tied to clients for each plugin. Thus I am trying to use the static player settings object. This seems to work so far, however the data is not cleared when a client disconnects.

The wiki mentions that "Player Settings members are reset during Sourcemod's OnClientDisconnect_Post forward". Contrary to that, set values persist for the clients, even after rejoining the server.

Looking at the plugin code of dynamic.sp, this seems to be due to the OnClientDisconnect_Post forward not using public, but being declared as stock instead.

PHP Code:
stock void OnClientDisconnect_Post(int client)
{
    
_Dynamic_ResetObject(client);

I am still an amateur at Sourcepawn so I might have completely missed something obvious here.
That would be the error. Thanks for letting me know. Try making the void public and recompiling.

I need to push some updates so I will try patch it up in the next few days.
__________________
Neuro Toxin is offline
Muhlex
Junior Member
Join Date: Mar 2019
Old 05-12-2019 , 20:04   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #286

I tried to do that but faced some errors on compile which are probably due to me having left out a file when installing. I didn't bother afterwards and can't get around to trying it again at the moment. However I did try to just include Dynamic_ResetObject(client) on Disconnect_Post in my own plugin earlier, which did fix the issue.

Last edited by Muhlex; 05-12-2019 at 20:07.
Muhlex is offline
freak.exe_uLow
AlliedModders Donor
Join Date: Jul 2012
Location: Germany
Old 09-02-2019 , 18:31   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #287

Hey, i hope the plugin still has support I use the plugin for an advertising plugin and wanted to have a look at the handles, can it be that these leaks has?

Code:
Plugin               Handles             Memory
dynamic.smx	     240	         76336 bytes
__________________

Last edited by freak.exe_uLow; 09-02-2019 at 18:32.
freak.exe_uLow is offline
Reply


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 23:23.


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