- If Java drives the conversation, the server should always be started to avoid a situation where a Python thread garbage collect an object and tries to communicate with the JVM (without a server, only the Python thread receiving a command from the Java side can respond).
- I need to dive into Python source code, but what if the garbage collector runs on the Python thread after sending back the response to the Java side (just before waiting for the Java side command)? It would try to send more information and would never receive a response...?
- Would it be desirable to run gc.collect() before sending back the response? This could be an option (enabled by default)? I tested that the thread that runs gc.collect() is the one executing the finalizers.
- This should not be an issue with traditional threading model because threads are created on demand (although if the current thread can be interrupted, this may be problematic).
该提问来源于开源项目:bartdag/py4j