4a-hal-generic: aborting with "Can't enter dispatch while in dispatch!" when a phone is connected via bluetooth

Description

When a phone is connected, 4a ends aborts, with the following error:

"Can't enter dispatch while in dispatch!"

After analysis, this is because a sync call (dynamic creation of the needed streams in softmixer) is performed. Replacing the afb_api_call_sync by a afb_api_call fixes it.

Environment

None

Activity

jose bollo 
February 8, 2019 at 11:53 AM

Thierry patched its binding accordlingly to the guidelines above

jose bollo 
February 7, 2019 at 9:57 AM

This happens when connecting to the systemd's event loop of the binder. (see function afb_api_get_event_loop [1]) It that case, it is not possible to call a synchronous call from the callback of the event. The reason is that the call back has to return before the even loop can be used. This limitation comes from systemd (but notice that reading an input in the callback is generally needed to avoid endless call to the event handler callback).

When you do a call_sync in the systemd event handler callback, the binder now emit the message "Can't enter dispatch while in dispatch!" and calls abort.

The implementation of the systemd event handler has to be changed to not block. You can use the asynchronous call variants if needed [2].

[1] http://docs.automotivelinux.org/master/docs/apis_services/en/dev/reference/af-binder/reference-v3/func-api.html#afbapigeteventloop
[2] http://docs.automotivelinux.org/master/docs/apis_services/en/dev/reference/af-binder/reference-v3/func-api.html#afbapicall

Fixed

Details

Assignee

Reporter

Fix versions

Labels

Contract ID

Affects versions

Priority

Created February 7, 2019 at 9:47 AM
Updated February 11, 2019 at 11:45 PM
Resolved February 8, 2019 at 11:53 AM

Flag notifications