Sharing .api btw 2 Apps causes App not working

So I have implemented the printer.api verison in helloIPC example (https://github.com/legatoproject/legato-af/tree/master/apps/sample/helloIpc) in my own code where i have 2 Apps running separately to make sure that i can commu8nicate/share api between the 2 Apps. I created the printer.api and followed same steps to add the requirements in my .adef && .cdef files && the issue I’m finding is that the App using the printer.api (Uplink App) will not run at all after I install it. I get the following logs with logread -f where my 1st app is running when I install my 2nd App.

Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | updateDaemon[528]/updateDaemon T=main | supCtrl.c supCtrl_StartApp() 60 | Starting app 'Uplink'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/legato/systems/current/apps/Uplink/read-only/lib/libComponent_UplinkComponent.so' to '/legato/systems/current/appsWriteable/Uplink/li
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/legato/systems/current/apps/Uplink/read-only/bin/Uplink' to '/legato/systems/current/appsWriteable/Uplink/bin/Uplink'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/usr/lib/libcrypto.so.1.0.2' to '/legato/systems/current/appsWriteable/Uplink/usr/lib/libcrypto.so.1.0.2'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/etc/ssl/certs/ca-certificates.crt' to '/legato/systems/current/appsWriteable/Uplink/etc/ssl/certs/ca-certificates.crt'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/usr/bin/curl' to '/legato/systems/current/appsWriteable/Uplink/usr/bin/curl'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/usr/lib/libcurl.so.5' to '/legato/systems/current/appsWriteable/Uplink/usr/lib/libcurl.so.5'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/usr/lib/libgnutls.so.28' to '/legato/systems/current/appsWriteable/Uplink/usr/lib/libgnutls.so.28'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/usr/lib/libnettle.so.4' to '/legato/systems/current/appsWriteable/Uplink/usr/lib/libnettle.so.4'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/usr/lib/libhogweed.so.2' to '/legato/systems/current/appsWriteable/Uplink/usr/lib/libhogweed.so.2'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/usr/lib/libgmp.so.10' to '/legato/systems/current/appsWriteable/Uplink/usr/lib/libgmp.so.10'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/lib/libz.so.1' to '/legato/systems/current/appsWriteable/Uplink/lib/libz.so.1'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/lib/libnss_compat.so.2' to '/legato/systems/current/appsWriteable/Uplink/lib/libnss_compat.so.2'.
Jun 26 15:39:18 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/lib/libnss_files.so.2' to '/legato/systems/current/appsWriteable/Uplink/lib/libnss_files.so.2'.
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/etc/nsswitch.conf' to '/legato/systems/current/appsWriteable/Uplink/etc/nsswitch.conf'.
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/etc/hosts' to '/legato/systems/current/appsWriteable/Uplink/etc/hosts'.
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/etc/resolv.conf' to '/legato/systems/current/appsWriteable/Uplink/etc/resolv.conf'.
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/lib/libnss_dns.so.2' to '/legato/systems/current/appsWriteable/Uplink/lib/libnss_dns.so.2'.
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/lib/libresolv.so.2' to '/legato/systems/current/appsWriteable/Uplink/lib/libresolv.so.2'.
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/bin/sh' to '/legato/systems/current/appsWriteable/Uplink/bin/sh'.
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/bin/date' to '/legato/systems/current/appsWriteable/Uplink/bin/date'.
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | proc.c proc_Start() 1190 | Starting process 'Uplink' with pid 15829
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | updateDaemon[528]/updateDaemon T=main | app.c app_InstallIndividual() 662 | App Uplink <3beee8e6f4404549995b2c9e11e4d398> installed
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | updateDaemon[528]/updateDaemon T=main | updateDaemon.c ApplyAppUpdate() 664 | App 'Uplink<3beee8e6f4404549995b2c9e11e4d398>' installed properly.
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | avcDaemon[549]/avcDaemon T=main | assetData.c assetData_DeleteInstance() 3160 | Deleting instance Uplink/0/0
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | avcDaemon[549]/avcDaemon T=main | assetData.c assetData_DeleteInstance() 3160 | Deleting instance Uplink/1/0
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | avcDaemon[549]/avcDaemon T=main | assetData.c assetData_CreateInstanceById() 2982 | Creating asset instance for Uplink/0
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | supervisor[15829]/supervisor T=main | proc.c proc_Start() 1155 | Execing 'Uplink'
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | avcDaemon[549]/avcDaemon T=main | assetData.c assetData_CreateInstanceById() 3079 | Finished creating instance 0 for Uplink/0
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | avcDaemon[549]/avcDaemon T=main | assetData.c assetData_CreateInstanceById() 2982 | Creating asset instance for Uplink/1
Jun 26 15:39:19 swi-mdm9x15 user.info Legato:  INFO | avcDaemon[549]/avcDaemon T=main | assetData.c assetData_CreateInstanceById() 3079 | Finished creating instance 0 for Uplink/1
Jun 26 15:39:19 swi-mdm9x15 user.debug Legato:  DBUG | _UNKNOWN_[15829]/<invalid> T=main | _componentMain.c _UplinkComponent_Init() 32 | Initializing UplinkComponent component library.
Jun 26 15:41:58 swi-mdm9x15 user.info Legato:  INFO | updateDaemon[528]/updateDaemon T=main | supCtrl.c supCtrl_StopApp() 101 | Stopping app 'Uplink'.
Jun 26 15:41:58 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | app.c app_Stop() 2731 | Stopping app 'Uplink'
Jun 26 15:41:58 swi-mdm9x15 user.info Legato:  INFO | supervisor[510]/supervisor T=main | apps.c DeactivateAppContainer() 340 | Application 'Uplink' has stopped.
Jun 26 15:41:58 swi-mdm9x15 user.info Legato:  INFO | updateDaemon[528]/updateDaemon T=main | system.c system_SymlinkApp() 547 | Creating symlink /legato/systems/current/apps/Uplink -> /legato/apps/c20509c9c1e4ad5ee63157431217cbb8
Jun 26 15:41:59 swi-mdm9x15 user.info Legato:  INFO | updateDaemon[528]/updateDaemon T=main | supCtrl.c supCtrl_StartApp() 60 | Starting app 'Uplink'
Jun 26 15:52:06 swi-mdm9x15 user.debug Legato:  DBUG | _UNKNOWN_[17400]/framework T=main | le_info_client.c DoConnectService() 391 | ======= Starting client for 'Uplink.UplinkComponent.le_info' service ========
Jun 26 15:52:06 swi-mdm9x15 user.debug Legato:  DBUG | Uplink[17400]/framework T=main | LE_FILENAME InitPool() 303 | Memory pool name 'framework.msgs-LogControlProtocol' is truncated to 'framework.msgs-LogControlProtoc'
Jun 26 15:52:06 swi-mdm9x15 authpriv.info dropbear[17392]: Exit (root): Disconnect received

Note that when it starts the le_info service

un 26 15:52:06 swi-mdm9x15 user.debug Legato:  DBUG | _UNKNOWN_[17400]/framework T=main | le_info_client.c DoConnectService() 391 | ======= Starting client for 'Uplink.UplinkComponent.le_info' service ========

which I’m include in my .adef like such:

bindings:
{
	Uplink.UplinkComponent.le_info -> modemService.le_info
	Uplink.UplinkComponent.printer -> MyAppComponent.printer
}

which makes me believe that it is “crashing” when i tried to start the printer service. The weird part is that even though logs show that Uplink has crashed and been stopped and restarted, it still shows as running in app status command but nothing is printed out (It is supposed to print out every 1 second some characters)

Now when I take out the printer.api sharing logic from my Uplink App .adef && .cdef then It works and prints out what it should do periodically and the logs look almost the same except for the following lines a end:

Jun 26 15:52:06 swi-mdm9x15 user.debug Legato:  DBUG | Uplink[17400]/Uplink_exe T=main | _main.c main() 56 | == Starting Event Processing Loop ==
Jun 26 15:52:06 swi-mdm9x15 user.info Legato:  INFO | Uplink[17400]/UplinkComponent T=main | uplink.cpp uplink_init() 75 | Finished initializing UplinkApp
Jun 26 15:52:06 swi-mdm9x15 user.debug Legato:  DBUG | Uplink[17400]/framework T=main | LE_FILENAME le_timer_Start() 982 | threadRecPtr->timerFD=9

I can always see the following when I install the first App:

Jun 26 18:03:51 swi-mdm9x15 user.debug Legato:  DBUG | _UNKNOWN_[1186]/framework T=main | printer_server.c printer_AdvertiseService() 338 | ======= Starting Server printer ========

But i never see the client part starting when I install the Uplink App. I’m supposed to see the following which never happens:

Jun 26 17:45:37 swi-mdm9x15 user.debug Legato:  DBUG | _UNKNOWN_[31271]/framework T=main | printer_client.c DoConnectService() 391 | ======= Starting client for 'Uplink.UplinkComponent.printer' service ========

What am I doing wrong??

Hey @mg_bg,

Would you be able to share your sample code in a repo or gist? I have a rough idea of what’s going on but it’s hard to say without some more details.

@nvd Unfortunately I can’t share my code But would like to hear your input on what u suspect the issue is?

In thebindings section of your application definition (.adef), you must bind to the name of the other app, not the component.

So this:

bindings:
{
	Uplink.UplinkComponent.le_info -> modemService.le_info
	Uplink.UplinkComponent.printer -> MyAppComponent.printer
}

should become something like this

bindings:
{
	Uplink.UplinkComponent.le_info -> modemService.le_info
	Uplink.UplinkComponent.printer -> printApp.printer
}
1 Like

Your solution solved my problem. Thanks:)

You’re welcome @mg_bg ! I look forward to building amazing things alongside this amazing community.