Legato api sharing btw 2 Apps causing sysfault

So I have created 2 Apps that are sharing a printer.api like in this tutorial:

everything seems to be working perfectly fine where I define the api in one App and extern it and require it in another App to use it. The issue happens if i stop the App that provides the printer.api, this causes a sysfault on the other App that requires it which triggers a restartApp(which is what i have in my .adef file) which again causes a sysfault which causes the whole mangho green deice to crash and restart/reboot. Now to stop this cycle from happening I have to ssh into device as soon as it is back online and stop the running App else another sysfault will be triggered.

How do I make it that when I stop (or if it crashes) the App that provides the api then by default the other App should stop to prevent sysfault from happening?

Hi mg_bg,

I am trying to simulate with Legato 17.06 sample app helloIpc, and add in printClient.adef:

faultAction: restartApp

When I stop printServer manually, I can see printClient get killed and restarted.
But it won’t trigger another sysfault or system reboot.

Would you share Legato logread log or your app/code to check?

Thx

@lotam Here are the logs from stoping the server process:

Jul 18 15:48:18 swi-mdm9x15 user.warn Legato: -WRN- | _appStopClient[2948]/framework T=main | LE_FILENAME CreateSocket() 550 | Socket opened as standard i/o file descriptor 2!
Jul 18 15:48:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | apps.c DeactivateAppContainer() 340 | Application 'Server' has stopped

And couple of seconds after the client process crashes with such logs (Note at this point I changes the faultAction: stopApp)

Jul 18 15:49:33 swi-mdm9x15 user.debug Legato:  DBUG | MyClientComponent[32599]/framework T=main | print_client.c print_Insert() 547 | Sending message to server and waiting for response : 280 bytes sent
Jul 18 15:49:33 swi-mdm9x15 user.warn Legato: -WRN- | MyClientComponent[32599]/framework T=main | LE_FILENAME unixSocket_SendMsg() 479 | sendmsg() failed with errno 32 (Broken pipe).
Jul 18 15:49:33 swi-mdm9x15 user.emerg Legato: *EMR* | MyClientComponent[32599]/framework T=main | print_client.c print_Insert() 550 | Valid response was not received from server
Jul 18 15:49:33 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | proc.c proc_SigChildHandler() 1942 | Process 'MyClientComponent' (PID: 32599) has exited with exit code 1.
Jul 18 15:49:33 swi-mdm9x15 user.crit Legato: *CRT* | supervisor[510]/supervisor T=main | app.c app_SigChildHandler() 3250 | Process 'MyClientComponent' in app 'Client' faulted: Stopping app.
Jul 18 15:49:33 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c app_Stop() 2731 | Stopping app 'Client'
Jul 18 15:49:33 swi-mdm9x15 user.warn Legato: -WRN- | _appStopClient[3092]/framework T=main | LE_FILENAME CreateSocket() 550 | Socket opened as standard i/o file descriptor 2!
Jul 18 15:49:33 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | apps.c DeactivateAppContainer() 340 | Application 'Client' has stopped

As you can fault is triggered when the print_Insert() function is called from client App while Server App is stopped. How does your printClient App behave? If ther is no fault then I would presume it would get killed and restarted over and over and over??

Hi mg_bg,
Not sure the print_Insert() function causing the exception, seems it was added by you?

The test app I am using is sample app comes with Legato framework, /apps/sample/helloIpc:
https://github.com/legatoproject/legato-af/tree/master/apps/sample/helloIpc

Please have a look.
Thx

Yes I did add the print_insert function which basically prints and afterward inserts the msg argument into a file. it is different from the sample helloIPC as there it only prints. And Yes I have seen and tried that sample example and noticed that it does stop after I stop the server App, but that is not the case for me which is what is perplexing me.

Hi mg_bg,
Thanks testing the sample app helloIpc, in such case check and debug your app may needed.
i.e. to find out specific or different in your app compare to helloIpc
Thx