ChildProcess randomly terminates on OSX

Hi,

When using the ChildProcessMaster/Slave classes, the slave process randomly terminates on OSX (I haven’t tried on other platforms yet.) This is also a problem in the demo for these classes in the DemoRunner.

I tried to send a message at a timed interval to keep it alive, but that doesn’t seem to do the trick, (and it looks like the classes should do that themselves in the background anyway)

Seeing this in the console. Something to do with a background app running on OSX?

default 09:40:20.402697-0500 DemoRunner LSExceptions shared instance invalidated for timeout. default 09:41:09.903165-0500 runningboardd [executable<DemoRunner(501)>:23150] Death sentinel fired! default 09:41:09.904722-0500 loginwindow -[PersistentAppsSupport applicationQuit:] | for app:DemoRunner, _appTrackingState = 2 default 09:41:09.904736-0500 loginwindow -[PersistentAppsSupport applicationQuit:] | App: DemoRunner, quit, updating active tracking timer

Thank you for your help,
Chris

Please can you test using the very latest JUCE version from the develop branch, as there have been some recent changes in these classes. If you still see the problems when using the latest version of JUCE then let us know, and we’ll take a look at the problem.

Of course! Thank you for getting back to me so quickly.

It looks like it is still doing it on the develop branch. (Thanks for renaming these classes btw!)

I downloaded the zip of the develop branch, ran the CMake with the demorunner, launched the demo runner, went to ChildProcessDemo, and ran the process. It still loses the child process at a random interval. (I am assuming that there is nothing I need to do to the code to keep it alive?) This is the output from the demo:

Child process started
Received: <HelloWorld/>
Connection lost to child process!

I am on MacOS Catalina v10.15.7.

Thanks!

Thanks for trying it out. I’ve added this to my backlog, and I’ll update this thread once I’ve made some progress on the issue.

1 Like

After digging at this all day, I believe the issue was with AppNap on OSX. The app would go to sleep and the interprocess connection ping send/receive would time out. I have disabled AppNap in my software, and it has been working. (I’m going to let it run overnight just in case)

The solution for now is to disable AppNap with an objective-c++ call in my application, using this answer from SO. Does JUCE have any functionality that will handle this yet?

Thanks for the update, unfortunately I haven’t got round to looking at this yet.

It’s possible to disable App Nap using juce::ScopedLowPowerModeDisabler.

Random related question to the ChildProcessMaster/Slave classes: Is there a way to get to DBG output from a child process when it is launched? I am using XCode, and am able to attach to the process for debugging, but cannot seem to see any console output from DBG (or cout). In the ChildProcess class you have readProcessOutput but with these classes is there a way to do something similar?