[ 
https://issues.apache.org/jira/browse/NIFI-12740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17823358#comment-17823358
 ] 

ASF subversion and git services commented on NIFI-12740:
--------------------------------------------------------

Commit 55738f85221f9408f52878af28e21b2e79145868 in nifi's branch 
refs/heads/main from Mark Payne
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=55738f8522 ]

NIFI-12740 Fixed Python to Java Object Binding

Fixed issue in NiFiPythonGateway that stems from the fact that the thread 
adding an object to the JavaObjectBindings was not necessarily the thread 
removing them. The algorithm that was in place assumed that the same thread 
would be used, in order to ensure that an object could be unbound before being 
accessed. The new algorithm binds each new object to all active method 
invocations and only unbinds the objects after all method invocations complete, 
regardless of thread. Additionally, found that many method calls could create 
new proxies on the Python side, just for getter methods whose values don't 
change. This is very expensive, so introduced a new @Idempotent annotation that 
can be added to interface methods such that we can cache the value and avoid 
the expensive overhead.

This closes #8456

Signed-off-by: David Handermann <[email protected]>


> Python Processors sometimes stuck in invalid state: 'Initializing runtime 
> environment'
> --------------------------------------------------------------------------------------
>
>                 Key: NIFI-12740
>                 URL: https://issues.apache.org/jira/browse/NIFI-12740
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 2.0.0-M1, 2.0.0-M2
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>            Priority: Blocker
>             Fix For: 2.0.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> When creating a Python processor, sometimes the Processor remains in an 
> invalid state with the message "Initializing runtime environment"
> In the logs, we see the following error/stack trace:
> {code:java}
> 2024-02-05 17:23:30,308 ERROR [Initialize SetRecordField] 
> org.apache.nifi.NiFi An Unknown Error Occurred in Thread 
> VirtualThread[#123,Initialize 
> SetRecordField]/runnable@ForkJoinPool-1-worker-5: 
> java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" 
> because "processorTypes" is null
> java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" 
> because "processorTypes" is null
>       at 
> org.apache.nifi.py4j.StandardPythonBridge.findExtensionId(StandardPythonBridge.java:322)
>       at 
> org.apache.nifi.py4j.StandardPythonBridge.createProcessorBridge(StandardPythonBridge.java:99)
>       at 
> org.apache.nifi.py4j.StandardPythonBridge.lambda$createProcessor$3(StandardPythonBridge.java:142)
>       at 
> org.apache.nifi.python.processor.PythonProcessorProxy.lambda$new$0(PythonProcessorProxy.java:73)
>       at java.base/java.lang.VirtualThread.run(VirtualThread.java:309) {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to