Unable to get response in child thread until parent thread remain free.

Description

Hello,

I have two application server and client. I have created a thread in client app. I am able to call server application using afb_api_call_sync from that thread and I am running a loop in my main thread of client application but I am not able to get response until my client application's main thread end its execution.

How to get response in child thread if main thread of application is still busy?

Environment

None

Attachments

3

Activity

Show:

Walt Miner 
May 10, 2023 at 8:36 PM

  Can this be resolved?

jose bollo 
February 27, 2023 at 12:29 PM

Please also note that a service (here B) is free to serialize its requests and to process it one after one, taking the time it requires. So even if there is an issue in afb-daemon, the case is still possible.

jose bollo 
February 27, 2023 at 10:29 AM

Agreeing there is something wrong in afb-daemon, I'd like to find a workaround that could solve your specific issue while waiting for a fix. So let discuss on what you posted...

If I understand correctly, the examples reflect your requirements. Here is what I understand:

  1. server-binding is a service that expose some API through binder mechanism, let call it A

  2. demo-service-binding is also a service that expose some API through binder mechanism, let call it B

  3. the service A depends of the service B. it calls B synchronously

  4. starting a thread for each request made to A is required by the logic of the service A

  5. the service B called by service A takes some time (sleep 5) what reveals that afb-daemon does not correctly handle multiple request as it should

I tried to use asynchronous calls/subcalls in service A with equal success: it fails because service B does not handle the incoming requests when busy.

Then I modified the service B (demo-service-binding) to either start a thread (solved the issue) or starting jobs (afb_api_queue_job - but fails).

So if you can't change the service B it is not possible to make a workaround and afb-daemon has to be fixed.

it is possible to use asynchronous versions (afb_api_call or afb_req_subcall) but on my test it does not change the issue.

shubham kadu 
February 27, 2023 at 7:23 AM
(edited)

Hello Josh,

Actually this issue is the next part of the . As I mention in https://lf-automotivelinux.atlassian.net/browse/SPEC-4699, I was unable to call server parallelly so I try to add threads in it (as shown in server-binding.c). Here I am calling demo-service from child thread of server. After calling it, I am calling "ping1" verb of server to make main thread of server busy.  (The problem of is still persist here when more than one bindings call server at a time)

So, if you see the log attached below, you will see that although the demo-service have sent the reply to server but child thread of server is not able get that response until the main thread of server ends it's execution.

Question: How  would I get the response in child thread irrespective of main thread is busy or free?

jose bollo 
February 24, 2023 at 4:44 PM

more detail is welcome. does it duplicates ?

Inactive

Details

Assignee

Reporter

Labels

Hardware Platform(s) Affected

QEMU x86_64

Affects versions

Due date

Priority

Created February 16, 2023 at 10:34 AM
Updated June 21, 2023 at 3:05 PM
Resolved June 21, 2023 at 3:05 PM