viSci Posted 22 hours ago Report Posted 22 hours ago I use subpanels frequently for UI management of instrument actors in a large SCADA application. Everything works well until shutdown of the top level actor. I am seeing some evidence that the child actors running in subpanels do not shutdown gracefully. For example in the cleanup case of my subpanel actors I have the following code which attempts to save the actors control settings to an ini file. This works fine in the IDE but fails in a built exe. As far as I can tell the vi reference is still viable at the start of the Cleanup case but the ini file does not get written to. Subpanel references are handled by the messenger framework automagically so I am wondering if there might be something going on I need to consider. Also I added the Save Default Profile message which I can call from the top level prior to shutdown and that seems to work in the exe. Quote
drjdpowell Posted 4 hours ago Report Posted 4 hours ago I would suspect your problem is that your app closes the main window before its finished all its shutdown operations like your INI file. That is fine in source, but it is my understanding that Windows will kill a process with no open windows (Google is failing me on confirming that). Things to try: Command your subactors to shutdown and wait on their replies before stopping the top level actor and closing the main window. Then you know your subactors have executed their shutdown actions. If there is a reason you can't tell them to shutdown (and you have to rely on auto shutdown). Then you need to keep a window open until your code has a chance to execute it's cleanup, so Windows doesn't kill you first. Quote
drjdpowell Posted 4 hours ago Report Posted 4 hours ago Here is an example from one of my Apps, where I shutdown multiple subactors (in an array) and wait for all to reply that they have fully shutdown (I'm using Scatter-Gather to allow all to shutdown in parallel): Quote
viSci Posted 53 minutes ago Author Report Posted 53 minutes ago For some reason I had assumed that the top level actor waited for child actors to reply to the boilerplate shutdown message. I will use your suggestion in the future, thanks! Quote
drjdpowell Posted 18 minutes ago Report Posted 18 minutes ago The automatic shutdown feature is implemented by a "watchdog", which watches for the launching actor to stop running and sends the message. This has the advantage that it always happens, even if the launching actor stops due to an out-of-memory error or hitting the stop button, but it has the disadvantage that shutdown happens only after the launching actor has stopped. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.