Setting up IPC options

Hi all,

in order to avoid starting crashed due to API provided by applications not running, I´ve tried to use [optional] or [manual-start] options for the API y the definition file, but always get a segmentation fault 11.

Are these option really working ?

Or I´m doing something wrong?

Regards

@idiaz,
We are not very clear with your explanation, Please provided more details on the issue you are facing and also the .cdef file which you are using.

Also below link provides you the complete information on .cdef file

Regards,
Muralidhara N.

Hi @muralinagraj

my .cdef looks like:

requires:
{
api:
{
${MANGOH_ROOT}/apps/myApp/myAppIPC.api [optional]
}
}

[optional] or [manual start]
I choose the options because:

  • Sometimes de server (providing the api) may not be in a running state.
  • If no option is selected, when running the client, this automatically crash. But maybe, the client sometimes won’t need the api (or the use is delayed in the program)
  • So I set the options to allow the client run without necessity of the server already running.

I find out this situation with both apps with auto start options, the client runs before the Server.

If you need more data don´t hesitate reply me.

Hi @idiaz,
Are you calling the myAppIPC_Connectservice() function from the client to connect to the server with [optional] or [manual start] options set in .cdef?

Regards,
Muralidhara N.

Hi @muralinagraj

I´m not calling the function immediately. Is called when some conditions are set and some data recorded.

If no option selected, Legato stops the app in its starting phase due to fail to connect IPC (if server is stopped).

If options are set:

  • Client app starts without problem, but a segmentation fault occurs when call the server function (server is running)

Regards

@idiaz,
With options set you are able to call the myAppIPC_Connectservice() and server starts, Then you try to call the server function to do some work and then there will be a segmentation fault ??

Regards,
Muralidhara N.

@muralinagraj

Yes !!! :slight_smile:

Regards

Hi @idiaz,
See that i have attached very simple applicationipc.zip (3.4 KB)
) with [manual-start] option, which is modified version of one of the legato sample App. I have tested starting and without starting the server, I don’t see any crash.
Let me know if this helps you.

Regards,
Muralidhara N.

@muralinagraj

A lot of thanks for your example!.

Performing a deep code review I found the problem, we had a TryConnectService instead of ConenectService. The problem here is TryConnect was used as ConnectService, ignoring returned value, provoking the error when call the api.

Besides, it was the first function called in the client…

A lot of thanks, and sorry for the inconvenience.

Regards

Iván