Running "legato stop" or "/etc/init.d/startlegato.sh stop" restart the module

Hi, I am running 16.10.1.m3 R14 and am setting up some start up script. To test this, I want to stop legato and then start it, to see if my changes have taken effect. However running either of the to above commands, causes the modem to restart?

How can I trace/log or view them (if existing)… to see what is causing the error?

Thanks,
Karl

It seems to be my app when shutdown with “legato stop” returning exit code 1. The strange thing is if I manually stop the app it seems to shutdown cleanly. It catches the SIGTERM event to close everything down.

When using app stop… the SIGTERM event fires and shutdown cleanly.
When using legato stop… the SIGTERM does NOT fire and exits with code 1 causing a system restart.

Any thoughts as to what can cause this? IS there a difference in the way these to command shut things down?

Hi @karlkuhn,

It’s supposed to do a SIGTERM, wait a little bit for the app to stop and send a SIGKILL.

So basically, we try to terminate a process nicely, and after a second we kill it not so nicely since it has not cleaned-up fast enough.

The timeout is not configurable, but you can try extending it in framework/c/src/supervisor/app.c on 16.10.
It’s the KillTimeout structure that should be modified.

But it might be that your app has not processed the signal fast enough. Do you use le_sig_SetEventHandler ? If so, maybe your event loop is busy doing something else, and the supervisor tries to kill the process before SIGTERM starts to be processed by your handler.
You could try running another thread and having the signal handled in another thread to see if it’s that.

@CoRfr thanks for your reply. Yes I managed to track that down in the legato code… But I wonder if my app is falling over when the other services are killed that my app use. In this case my app seems to exit before is asked to shut down, immediately after the avvService is stopped.

My application’s faultAction is set to reboot. So I don’t actually think it is getting as far as sending the SIGTERM signal to my application. What is the right way to handle services terminating that an app is connected to?

The 5th last line kills the service and then my app AirvantageConnect dies.

eb 11 15:58:02 | Legato |  INFO | supervisor[584]/supervisor T=main | apps.c ShutdownNextApp() 411 | Application 'audioService' has stopped.
Feb 11 15:58:02 | Legato |  INFO | supervisor[584]/supervisor T=main | app.c app_Stop() 2731 | Stopping app 'avcService'
Feb 11 15:58:03 | Legato | -WRN- | supervisor[584]/supervisor T=main | app.c HardKillApp() 1008 | Hard killing app 'avcService'
Feb 11 15:58:03 | Legato | *EMR* | AirvantageConnect[925]/framework T=main | LE_FILENAME ClientSocketHangUp() 852 | Session closed by server (AirvantageConnect.AirvantageComponent.le_avc:e383429612e65fd1ac1599c3838625ae).
Feb 11 15:58:03 | Legato |  INFO | dcsDaemon[614]/dataConnectionService T=main | dcsServer.c CloseSessionEventHandler() 2327 | Client 0x28acc killed, remove allocated resources
Feb 11 15:58:03 | Legato |  INFO | supervisor[584]/supervisor T=main | proc.c proc_SigChildHandler() 1942 | Process 'AirvantageConnect' (PID: 925) has exited with exit code 1.
Feb 11 15:58:04 | Legato | *CRT* | supervisor[584]/supervisor T=main | app.c app_SigChildHandler() 3227 | Process 'AirvantageConnect' in app 'AVConnect' faulted: Restarting process.