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

Add proper error handling for PyObject.getPointer() from jpy #2292

Merged

Conversation

devinrsmith
Copy link
Member

No description provided.

@devinrsmith
Copy link
Member Author

Here is the nice exception, instead of silent corruption and potential SIGSEGV:

server_1      | java.lang.RuntimeException: Error in Python interpreter:                                                                                                                                                                        
server_1      | Type: <class 'RuntimeError'>                                                                                                                                                                                                    
server_1      | Value: java.lang.IllegalStateException: PyObjectState has already been taken                                                                                                                                                    
server_1      |         at org.jpy.PyObjectState.borrowPointer(PyObjectState.java:28)                                                                                                                                                           
server_1      |         at org.jpy.PyObject.getPointer(PyObject.java:165)                                                                                                                                                                       
server_1      |         at org.jpy.PyLib.callAndReturnValue(Native Method)                                                                                                                                                                      
server_1      |         at org.jpy.PyProxyHandler.invoke(PyProxyHandler.java:120)                                                                                                                                                               
server_1      |         at io.deephaven.engine.util.$Proxy6.create_change_list(Unknown Source)                                                                                                                                                  
server_1      |         at io.deephaven.engine.util.PythonDeephavenSession.createDiff(PythonDeephavenSession.java:235)                                                                                                                          
server_1      |         at io.deephaven.engine.util.PythonDeephavenSession.createDiff(PythonDeephavenSession.java:49)                                                                                                                           
server_1      |         at io.deephaven.engine.util.AbstractScriptSession.applyDiff(AbstractScriptSession.java:136)                                                                                                                             
server_1      |         at io.deephaven.engine.util.AbstractScriptSession.incrementalSnapshot(AbstractScriptSession.java:121)                                                                                                                   
server_1      |         at io.deephaven.engine.util.AbstractScriptSession.reproFailure(AbstractScriptSession.java:113)                                                                                                                          
server_1      |         at io.deephaven.server.console.ConsoleServiceGrpcImpl.lambda$initializeGlobalScriptSession$0(ConsoleServiceGrpcImpl.java:128)                                                                                           
server_1      |         at java.base/java.lang.Thread.run(Thread.java:829) 

@devinrsmith devinrsmith merged commit 843ca9a into deephaven:main Apr 19, 2022
@devinrsmith devinrsmith deleted the jpy-pyobject-getpointer-handling branch April 19, 2022 20:42
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JPY: already-closed PyObject arguments passed to PyObject.call or PyProxyHandler cause a core dump
2 participants