Skip to content

ADSB: fix deadlock issue #3109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2023
Merged

Conversation

robertlong13
Copy link
Collaborator

The call to MainV2.comPort.sendPacket waits for MAVLinkInterface.objlock to release. This can cause a deadlock if the MAVLinkInterface thread has also called adsb_UpdatePlanePosition, and is waiting on this thread to release adsblock. adsblock is only needed for accessing the adsbPlanes list, so this commit restricts the lock to only where it is needed.

When constructing the mavlink packet, adsbPlanes and adsb are used a bit randomly. I changed those all to read from adsb, and moved them out of the locked section as well.

The call to MainV2.comPort.sendPacket waits for MAVLinkInterface.objlock
to release. This can cause a deadlock if the MAVLinkInterface thread
has also called adsb_UpdatePlanePosition, and is waiting on this thread
to release adsblock. adsblock is only needed for accessing the
adsbPlanes list, so this commit restricts the lock to only where it is
needed.
@meee1 meee1 merged commit 2f5b59a into ArduPilot:master Apr 28, 2023
@robertlong13 robertlong13 deleted the adsb_deadlock_fix branch July 2, 2023 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants