jblas icon indicating copy to clipboard operation
jblas copied to clipboard

JDK crash multithreading

Open XePeleato opened this issue 3 years ago • 1 comments

Hello, I've been using this library for my research, it's great! I've recently come across an issue when working on multiple threads, I can't get it to reproduce consistently, it just happens, more consistently if I use ~24 threads.

I have enabled the -Xcheck:jni flag and this is the output when it crashes:

FATAL ERROR in native method: Using JNIEnv in the wrong thread
        at org.jblas.NativeBlas.dgeev(Native Method)
        at org.jblas.NativeBlas.dgeev(NativeBlas.java:302)
        at org.jblas.SimpleBlas.geev(SimpleBlas.java:375)
        at org.jblas.Eigen.eigenvalues(Eigen.java:89)

It indeed looks like a threading issue, however, it's not as obvious as it seems to me, since dgeev uses no cached reference to JNIEnv.

This happens only with the dgeev function, my application calculates eigenvalues and also does quite some matrix to matrix operations.

Also, it happens on a CentOs 7 amd64 system.

I'll be happy to provide any other detail necessary to address this issue.

Thanks!

XePeleato avatar Oct 11 '21 19:10 XePeleato

Hey!

Thanks for your patience. Does this problem persist? Can you tell me a bit more about this? Are the matrices shared or are they completely separate? How many cores does your machine have?

Best,

Mikio

mikiobraun avatar Nov 02 '21 15:11 mikiobraun