Jump to content

Messenger Library (Subpanel Caveats)


Recommended Posts

Posted

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. 

image.png.f68024c3196977ba25896588b629c49a.png

Posted

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.

Posted

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):

image.png.89b1cd38bf44fde8271f894061f7d1f1.png

Posted

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!

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.