lava icon indicating copy to clipboard operation
lava copied to clipboard

Need to call Runtime.stop() automatically

Open awintel opened this issue 4 years ago • 3 comments

Right now, we require users to call Runtime.stop() or AbstractProcess.stop() explicitly at the end of a run to shut remote processes and RuntimeServices down.

However, people tend to forget this. Therefore we should overload the Runtime or AbstractProcess destructor to call stop automatically when these objects get garbage collected in the current user system process, i.e. when the user code finishes. This will become even more critical once the Runtime allocates actual Loihi systems.

Users should still be encouraged to call stop() explicitly as soon as they are done with their Lava processes but it should not be a requirement.

awintel avatar Nov 07 '21 20:11 awintel

Was just trying this out but this does not seem to be working. For some reason the del never gets called if you just let a program finish.

awintel avatar Nov 21 '21 21:11 awintel

I'll take another look. How did you try it out?

mgkwill avatar Nov 21 '21 21:11 mgkwill

I'm working on a new tutorial with RunContinuous and non-blocking mode and I just omitted stop() at the end. I expected this not to matter because stop() should get called upon garbage collection but that did never happen. So perhaps something must prevent the script from finishing and garbage collecting the process on which stop() did not get called.

awintel avatar Nov 21 '21 22:11 awintel