-
Notifications
You must be signed in to change notification settings - Fork 178
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
Unable to start JVM #84
Comments
That like as i performed startJVM already, And i perform it again, But i did never do that.
In the test enviroment use Python Shell perform startJVM, is no problem,But we use uwsgi start web project and to request it, startJVM throw that Exception. |
That's so weird, Anyway, If i find solution, i would submit. |
I've written a simple testcase e2b128c, which uses two threads calling attachThreadToJVM and it fails, if run in parallel: Not the actual method call of attachThreadToJVM is failing, but the call to a java method afterwards. @baztian hope thats the right way to handle multiple threads?! |
Error occurred during initialization of VM |
Hi @marscher , it seems to be a conflict with system.out accessing the console in parallel somehow. See my attempt for a testcase: baztian@9498a5b |
i have to change another way.... T . T |
@marscher, for some reason, running my test isolated gives me a fatal error.
Using java version "1.7.0_67" |
@baztian which operation in this method causes the segfault? |
I can reproduce the error only every two or three runs. I can't tell which operation causes the error. But I couldn't reproduce the error if I don't call java code in the thread. In my example it works if I remove the jpype.java.lang.String constructor call. |
Well, it sounds like a race condition for the jvm access. |
Tried some multithreading stuff with really weird results. Test
(not in a new python thread) results in
So the code seems to be executed but at some (unkown) point the process dies. The following test
usually results in
And then stops at this point (I have to kill the process with Ctrl-C). And even weirder: the code sometimes just works. @marscher, you are right, no (at all time) working test case for jpype multithreading. |
Doesn't seem to be a recent regression. JPype1 0.5.4.3 has the same issue. |
Was hoping that this commit from @tcalmant using the GIL for something I don't understand could help (see discussion in #18). Unfortunately the test still fails. |
BTW: The test only fails if I run it like this: |
sounds very strange. It succeeded in how many runs? We already noticed |
I did not manage to make the test fail if I run the whole suite.
) |
well that is at least a starting point to investigate this. But very |
I guess it has something to do with the state of the jpype module. If I change the name multithreading.py to abmultithreading.py it get's executed first. And now it fails with the same rate as with the selective method. |
This intuition should be perfectly right. But how the hell we can pin |
The discussion here leads me to a more general question. Is JPype designed and able to execute multiple threads? Are those threads executed in the same JVM instance or in several processes individually? I've seen strange issues with Java when there are two JVM instances running in parallel. |
JPype is able to execute Java code from multiple Python threads or multiple Java threads. In the first case make sure you call attachThreadToJVM and detachThreadToJVM in the corresponding Python threads. JPype only allows one JVM instance during one Python interpreter session. |
same error, to reproduce: |
@StevenLOL according to the fine documentation, "restarts" are not supported by the JVM. |
@marscher , thanks! |
I got around this problem by creating a shell script . When program finished JVM can be shutdown . then parameters are passed from the shell script |
I push the code to the test enviroment , and there are another Exception.... T . T
The project in my enviroment there are no problem.
Exception in below.
java version "1.6.0_32"
OpenJDK Runtime Environment (IcedTea6 1.13.4) (6b32-1.13.4-4ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
We use uwsgi to start project , is that problem?
The text was updated successfully, but these errors were encountered: