Skip to content
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

zebra: avoid a race during FPM dplane plugin shutdown #17504

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

mjstapp
Copy link
Contributor

@mjstapp mjstapp commented Nov 25, 2024

During zebra shutdown, the main pthread in fpm_nl_finish_early() and the FPM pthread can deadlock if the FPM pthread is in fpm_reconnect(). Each pthread tries to use event_cancel_async() to cancel tasks that may be scheduled for the other pthread - this leads to deadlock as neither thread can progress.

This adds an atomic boolean that's managed as each pthread enters and leaves the cleanup code in question, preventing the two threads from running into the deadlock.

During zebra shutdown, the main pthread and the FPM pthread can
deadlock if the FPM pthread is in fpm_reconnect(). Each pthread
tries to use event_cancel_async() to cancel tasks that may be
scheduled for the other pthread - this leads to a deadlock as
neither thread can progress.

This adds an atomic boolean that's managed as each pthread
enters and leaves the cleanup code in question, preventing the
two threads from running into the deadlock.

Signed-off-by: Mark Stapp <[email protected]>
@mjstapp mjstapp added the bugfix label Nov 25, 2024
@frrbot frrbot bot added the zebra label Nov 25, 2024
@donaldsharp donaldsharp merged commit e8fdbbe into FRRouting:master Nov 26, 2024
16 checks passed
@mjstapp mjstapp deleted the fix_fpm_cancel_race branch December 3, 2024 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants