This is an automated email from the ASF dual-hosted git repository. markap14 pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push: new e03329e01f NIFI-12739 - Import ProcessPoolExecutor to fix bug in python 3.9+ (#8357) e03329e01f is described below commit e03329e01f491b88f6f90e5285cb034e204d9363 Author: Alex Ethier <39684038+alexeth...@users.noreply.github.com> AuthorDate: Wed Feb 14 12:50:01 2024 -0500 NIFI-12739 - Import ProcessPoolExecutor to fix bug in python 3.9+ (#8357) * NIFI-12739 Import ProcessPoolExecutor to fix bug in python 3.9+ that causes Exceptions to be raised incorrectly in multi-threaded applications (https://bugs.python.org/issue42647) * Removed extraneous whitespace. --- .../src/main/python/framework/Controller.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nifi-nar-bundles/nifi-py4j-bundle/nifi-python-framework/src/main/python/framework/Controller.py b/nifi-nar-bundles/nifi-py4j-bundle/nifi-python-framework/src/main/python/framework/Controller.py index 4425fd26b3..8919924c06 100644 --- a/nifi-nar-bundles/nifi-py4j-bundle/nifi-python-framework/src/main/python/framework/Controller.py +++ b/nifi-nar-bundles/nifi-py4j-bundle/nifi-python-framework/src/main/python/framework/Controller.py @@ -15,18 +15,19 @@ import logging import os -from concurrent.futures import ThreadPoolExecutor +from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor from py4j.java_gateway import JavaGateway, CallbackServerParameters, GatewayParameters import ExtensionManager -# We do not use ThreadPoolExecutor, but it must be kept here. Python introduced a bug in 3.9 that causes Exceptions to be raised +# We do not use ThreadPoolExecutor or ProcessPoolExecutor, but they must be kept here. Python introduced a bug in 3.9 that causes Exceptions to be raised # incorrectly in multi-threaded applications (https://bugs.python.org/issue42647). This works around the bug. -# What is actually necessary is to import ThreadPoolExecutor. +# What is actually necessary is to import ThreadPoolExecutor and ProcessPoolExecutor. # Unfortunately, IntelliJ often likes to cleanup the unused import. So we assign a bogus variable just so -# that we have some reference to ThreadPoolExecutor in order to prevent the IDE from cleaning up the import +# that we have some reference to ThreadPoolExecutor and ProcessPoolExecutor in order to prevent the IDE from cleaning up the import threadpool_attrs = dir(ThreadPoolExecutor) +processpool_attrs = dir(ProcessPoolExecutor) # Initialize logging