MINIFICPP-2791 Fix deadlock during C2 flow update#2163
Closed
lordgamez wants to merge 3 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a reported deadlock during C2-driven flow updates by changing the shutdown/reload ordering around controller services and by making the ProcessGroup on-schedule retry timer teardown thread-safe.
Changes:
- Parse new flow payload before stopping the running flow, then clear controller services only after timer/scheduler threads are stopped (FlowController).
- Add a dedicated mutex for
ProcessGroup::onScheduleTimer_access and restructure timer stop/destroy logic to avoid stop/join deadlocks (ProcessGroup). - Adjust
CallBackTimerdestructor locking to avoid potential destructor-time lock contention.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| libminifi/src/FlowController.cpp | Reorders flow update steps to defer controller-service clearing until after schedulers/timers are stopped. |
| libminifi/src/core/ProcessGroup.cpp | Adds synchronization and a safer stop/destroy loop for the onSchedule retry timer to prevent deadlocks. |
| libminifi/include/core/ProcessGroup.h | Introduces on_schedule_timer_mutex_ to guard onScheduleTimer_. |
| core-framework/src/utils/CallBackTimer.cpp | Simplifies destructor by removing an extra mutex lock before joining the thread. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
szaszm
reviewed
May 4, 2026
martinzink
approved these changes
May 5, 2026
fgerlits
approved these changes
May 11, 2026
szaszm
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/MINIFICPP-2791
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically main)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.