Forum rss-feed

Forum

Developers: agent - native destructor taking ages to be GC'd

Most Recent

written by: TheTechnobear

ok. ive fixed my issue, using agent unload in python, to free critical resources.

im guessing Osc Output should do the same, as it will probably fail to create a new agent if you try too do it to fast after deleting existing. as it frees the port on dtor which may not have been called yet

written by: TheTechnobear

Sat, 6 Jul 2013 11:44:39 +0100 BST

hi,

Ive got a bit of a problem with my agent shutting down.

where I delete it in WB, I can see it being 'unloaded', erased... in the logs i get:
eigend-backend: erasing agent
BUT, it takes several passes of the GC, before it decides it is going to call the dtor, or native class, and then the subsequent impl etc.
(this is true, even if the agent is not connected to anything else)

during, the period between unload, and the dtor being called, nothing really changes i.e. i don't know why after 30 seconds or so, it decides its allowed to be GC'd and not before.
the only thing i do note, is you seem to have 2 type of GC passes?
eigend-garbage: starting gc pass 0
eigend-garbage: starting gc pass 1
and it seems to be the later, than decides it can invoke my door.


the issue, is I have clean up code, that must be executed before the agent can be created a again. (due to the server it is connecting too)


Is there a way in the python wrapper, i can get a callback to the erase/unload,
if so, then at least I could disconnect from the server, and then wont be waiting on the GC.
(which is never good programming practice anyway!)

Thanks
Mark

more full logs here:

eigend-backend: unloading a('',osc_pad,'2.0.76-stable','0.0.1',1) destroy= True
eigend: : agent unload, destroy= True
eigend: : notify destroy
eigend: : #1 notify destroy
eigend: : #1.1 notify destroy
eigend: : #2 notify destroy
eigend: : #2.1 notify destroy
eigend: : #2.2 notify destroy
eigend: : #2.3 notify destroy
eigend: : #2.4 notify destroy
eigend: : #3 notify destroy
eigend: : #3.1 notify destroy
eigend: : #3.2 notify destroy
eigend: : #3.3 notify destroy
eigend: : #3.4 notify destroy
eigend: : #4 notify destroy
eigend: : #252 notify destroy
eigend-backend: controller closing
eigend-backend: saved final state of as 398421
eigend-backend: erasing agent
eigend-garbage: starting gc pass 0
eigend-garbage: gc collected 12
eigend-garbage: finished gc pass 0
eigend: fast going passive
eigend: fast going passive
eigend-garbage: starting gc pass 0
eigend-garbage: finished gc pass 0
eigend-garbage: starting gc pass 0
eigend-garbage: finished gc pass 0
eigend-garbage: starting gc pass 0
eigend-garbage: finished gc pass 0
eigend-garbage: starting gc pass 0
eigend-garbage: finished gc pass 0
eigend-garbage: starting gc pass 0
eigend-garbage: finished gc pass 0
eigend-garbage: starting gc pass 1
eigend-garbage: osc_pad_t::impl_t::~impl_t
eigend-garbage: osc_server_t::osc_shutdown
eigend: : osc_server_t::thread_term
eigend: : osc_server_t::thread_term, freeing server
eigend-garbage: light_wire_t::~light_wire_t





written by: TheTechnobear

Sat, 6 Jul 2013 12:25:21 +0100 BST

Ok, ive just noticed Osc Output also has the same issue.
(and I think Latch as well, though that appeared ok first time i tried)

Also on thinking about this, I really do think I need an agent unload callback, freeing up critical resources should never be done in GC time.
as GC should be allowed to be done 'as and when' is a good time, but freeing critical resources should be done immediately.

(a bit like in Java you never put thinks like server shutdowns in finalizer - very bad practice)

EDIT : just noticed, an agent unload, will try to hook into that


written by: TheTechnobear

Sat, 6 Jul 2013 12:34:52 +0100 BST

ok. ive fixed my issue, using agent unload in python, to free critical resources.

im guessing Osc Output should do the same, as it will probably fail to create a new agent if you try too do it to fast after deleting existing. as it frees the port on dtor which may not have been called yet



Please log in to join the discussions