App starting twice?

Hi,
I made a simple CLI app which reads the arguments that are given to it. It’s crashing as soon as I try to use the output of le_args_getArgs(), but it’s still working.
So I wondered what was going on and then I saw that the app is somehow started twice. One instance gives the correct behavior, but the otherone is crashing because of a NULL pointer:

INFO | testcli[32064]/testCliComp T=main | testcli.cpp _testCliComp_COMPONENT_INIT() 17 | num args: 0
INFO | testcli@0[32065]/testCliComp T=main | testcli.cpp _testCliComp_COMPONENT_INIT() 17 | num args: 2
INFO | testcli[32064] | num args: 0
INFO | testcli[32064] | args: (null)

My test.sdef:

commands:
{
	testcli = testcli:/bin/testcli
}

My testcli.adef

start: manual

executables:
{
	testcli = ( testCliComp )
}

processes:
{
	run:
	{
		( testcli )
	}
}

Why is the app starting twice? What’s going on here?

Thanks,
Simon

You can use “app runproc” and see if it will start correctly

E.g.
app runProc modemDemo send --exe=send – 1234567 “Online”

I tried your suggestion, but it’s behaving exactly the same as before.

I don’t see problem, you can try with my modemdemo1 application.
modemDemo1.rar (1.1 MB)

root@swi-mdm9x28-wp:~# app status
[running] atAirVantage
[running] atQmiLinker
[running] atService
[running] audioService
[running] avcService
[running] cellNetService
[running] dataConnectionService
[running] fwupdateService
[running] gpioService
[running] modemService
[running] portService
[running] positioningService
[running] powerMgr
[running] qmiAirVantage
[running] secStore
[stopped] smsInboxService
[stopped] spiService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[stopped] wifiApTest
[stopped] wifiClientTest
[running] wifiService
[stopped] wifiWebAp
[stopped] hello1
[running] modemDemo1
root@swi-mdm9x28-wp:~# logread -f &
root@swi-mdm9x28-wp:~# app runProc modemDemo1 send --exe=send – 1234567 “Sim”
root@swi-mdm9x28-wp:~# Aug 8 21:41:10 swi-mdm9x28-wp user.warn Legato: -WRN- | supervisor[829]/supervisor T=main | proc.c GetWatchdogAction() 359 | send watchdogAction ‘’ in proc section
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[829]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxCoreDumpFileBytes to value 8192.
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[829]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxFileBytes to value 90112.
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[829]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxLockedMemoryBytes to value 8192.
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[829]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxFileDescriptors to value 256.
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[829]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxMQueueBytes to value 512.
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[829]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxThreads to value 20.
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[829]/supervisor T=main | resourceLimits.c SetRLimitValue() 282 | Setting resource limit maxQueuedSignals to value 100.
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[829]/supervisor T=main | proc.c proc_Start() 1390 | Starting process ‘send’ with pid 1802
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1802]/supervisor T=main | proc.c proc_Start() 1355 | Execing ‘send’
Aug 8 21:41:10 swi-mdm9x28-wp user.err Legato: =ERR= | modemDaemon[861]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 795 | Sending QMI_UIM_GET_EID_RESP_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=3.[0x03]
Aug 8 21:41:10 swi-mdm9x28-wp user.err Legato: =ERR= | modemDaemon[861]/le_pa T=main | pa_sim_qmi.c pa_sim_GetCardEID() 2837 | Failed to get the EID
Aug 8 21:41:10 swi-mdm9x28-wp user.err Legato: =ERR= | modemDaemon[861]/modemDaemon T=main | le_sim.c le_sim_GetEID() 1471 | Failed to get the EID of sim identifier.1
Aug 8 21:41:10 swi-mdm9x28-wp user.info Legato: INFO | supervisor[829]/supervisor T=main | proc.c proc_SigChildHandler() 2051 | Process ‘send’ (PID: 1802) has exited with exit code 0.
Aug 8 21:41:23 swi-mdm9x28-wp user.info kernel: [ 121.441872] sierra_startup_monitor

I can see that it’s starting twice with 2 different PIDs.
Anyways, I went another path where I parse the arguments not in the COMPONENT_INIT, and that works.

I’m just curios why the app is started twice.

no idea, but it is good that now it works.