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

pyjnius is still not thread-safe? #71

Open
pubfox opened this issue Aug 21, 2013 · 4 comments
Open

pyjnius is still not thread-safe? #71

pubfox opened this issue Aug 21, 2013 · 4 comments

Comments

@pubfox
Copy link

pubfox commented Aug 21, 2013

Hi, All
I have to invoke a static java method in my task(django-celery) through pyjnius. It works fine for the first task. But it throws exception while executing the 2nd task. Check the jvm log, it shows

Internal exceptions (1 events):
Event: 0.058 Thread 0x0000000001ae2800 Threw 0x0000000704a06140 at /build/buildd/openjdk-7-7u25-2.3.10/build/openjdk/hotspot/src/share/vm/prims/jni.cpp:3994

Seems this is thread problem, right?
How can i fix this?

BTW, misja, can i make it works through gevent?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1362782-pyjnius-is-still-not-thread-safe?utm_campaign=plugin&utm_content=tracker%2F77133&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F77133&utm_medium=issues&utm_source=github).
@Mactory
Copy link

Mactory commented Sep 27, 2017

I seem to have a similar problem. Trying to run a task through celery I get a "VM is already running, can't set classpath" Problem. Do you have a solution for running pyjnius in celery?

@kfirstri
Copy link

kfirstri commented Mar 7, 2019

I seem to have a similar problem. Trying to run a task through celery I get a "VM is already running, can't set classpath" Problem. Do you have a solution for running pyjnius in celery?

same issue, anyone found an answer?

@jun0-ds
Copy link

jun0-ds commented Sep 10, 2019

I seem to have a similar problem. Trying to run a task through celery I get a "VM is already running, can't set classpath" Problem. Do you have a solution for running pyjnius in celery?

same issue, anyone found an answer?

the error "VM is already running, can't set classpath" means one of imported packages is using JVM.

so i think there will be multiple lines that imports jnius.

please show your code lines of importing packages

or if there are lines like "import jnius" and "import [package_name_A]"
and if the package_name_A imports jnius inside the package, then you need to remove one of the import lines.

@Julian-O
Copy link
Contributor

@jun0-ds's solution [i.e. avoid importing the same class twice] isn't a conventional way of using Python.

Importing twice shouldn't lead to problems. It suggests that the jnius module has side-effects on import. I haven't looked to confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants