-
Notifications
You must be signed in to change notification settings - Fork 2.9k
NIFI-15449 - NAR deletion blocks indefinitely when Python processor is initializing #10753
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
base: main
Are you sure you want to change the base?
Conversation
…s initializing Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>
exceptionfactory
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this issue @pvillard31. The general strategy looks good. I noted a few initial recommendations. I also recommend reviewing most of the new log and exception messages to include a relevant detail, such as the Process ID or component ID where applicable.
| private volatile String identifier; | ||
| private volatile PythonController controller; | ||
| private volatile CompletableFuture<Void> initializationFuture; | ||
| private volatile boolean cancelled = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although either is technically acceptable English, other references in the project use canceled with one letter L, so I recommend using that form throughout these changes.
| // This allows the venv creation to be interrupted when the process is being shut down | ||
| while (!venvProcess.waitFor(1, TimeUnit.SECONDS)) { | ||
| if (isShutdown()) { | ||
| logger.info("Interrupting Python Virtual Environment creation due to shutdown"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to include the Process ID in this log.
| if (isShutdown()) { | ||
| logger.info("Interrupting Python Virtual Environment creation due to shutdown"); | ||
| venvProcess.destroyForcibly(); | ||
| throw new IOException("Python process shutdown during virtual environment creation"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Process ID would be helpful to include in this message.
Summary
NIFI-15449 - NAR deletion blocks indefinitely when Python processor is initializing
The issue is caused by:
StandardPythonBridgeandStandardExtensionDiscoveringManager:StandardExtensionDiscoveringManagerlock -> waits forStandardPythonBridgelockStandardPythonBridgelock -> callsgetNarDirectories()which waits forStandardExtensionDiscoveringManagerlockChanges:
StandardPythonBridgesynchronized block, ensuring locks are always acquired in a consistent order.isShutdown()checks during venv creation and dependency installation loops in PythonProcessCANCELLEDstate toAsyncLoadedProcessor.LoadStateand acancelLoading()methodStandardPythonProcessorBridgethat sets a flag checked during initializationstart()is called) so they can be properly shut down during NAR deletionTracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000VerifiedstatusPull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
./mvnw clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation