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

new_object: accessed stale local reference #44

Closed
dbrgn opened this issue Sep 25, 2017 · 4 comments
Closed

new_object: accessed stale local reference #44

dbrgn opened this issue Sep 25, 2017 · 4 comments
Labels

Comments

@dbrgn
Copy link
Contributor

dbrgn commented Sep 25, 2017

I have a simple POJO class with an empty constructor.

public IceCandidate() { }

This is what the JNI class looks like according to javap:

public class ch.dbrgn.candidateparser.IceCandidate {
  public ch.dbrgn.candidateparser.IceCandidate();
  ...
}

When I try to create a new instance for that class:

let myobj = env.new_object("ch/dbrgn/candidateparser/IceCandidate", "()V", &[]).unwrap();

...then I get a native crash.

JNI ERROR (app bug): accessed stale local reference 0x5 (index 1 in a table of size 1)
art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: use of deleted local reference 0x5
art/runtime/java_vm_ext.cc:410]   native: #02 pc 0025a775  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+740)
art/runtime/java_vm_ext.cc:410]   native: #03 pc 0025aecb  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+74)
art/runtime/java_vm_ext.cc:410]   native: #05 pc 00101211  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE.constprop.95+684)
art/runtime/java_vm_ext.cc:410]   native: #06 pc 00108ac5  /system/lib/libart.so (_ZN3art8CheckJNI10NewObjectAEP7_JNIEnvP7_jclassP10_jmethodIDP6jvalue+436)
art/runtime/java_vm_ext.cc:410]   native: #07 pc 000099db  /data/app/ch.dbrgn.candidateparser.test-1/lib/arm/libcandidateparser_jni.so (Java_ch_dbrgn_candidateparser_CandidateParser_parseSdp+3230)

Any idea what reference that could be? I've tried to debug this for quite a while now.

@jrobsonchase
Copy link
Contributor

ah crap. Can you roll your version of the jni crate back to 0.5.3 and try again? I bet it's the most recent change that did it.

@dbrgn
Copy link
Contributor Author

dbrgn commented Sep 25, 2017

Yeah, that works! 🎉

jrobsonchase added a commit that referenced this issue Sep 25, 2017
Got a little too aggressive with the new AutoLocal type.

Removed all creation of auto locals when `Desc::lookup` is used since it
can result in an existing object getting deleted prematurely.

Should probably address that in the future, but this works for right
now.
jrobsonchase added a commit that referenced this issue Sep 25, 2017
Got a little too aggressive with the new AutoLocal type.

Removed all creation of auto locals when `Desc::lookup` is used since it
can result in an existing object getting deleted prematurely.

Should probably address that in the future, but this works for right
now.
jrobsonchase added a commit that referenced this issue Sep 25, 2017
Got a little too aggressive with the new AutoLocal type.

Removed all creation of auto locals when `Desc::lookup` is used since it
can result in an existing object getting deleted prematurely.

Should probably address that in the future, but this works for right
now.
@jrobsonchase
Copy link
Contributor

OK, grab version 0.6.1 now. Should be fixed!

@dbrgn
Copy link
Contributor Author

dbrgn commented Sep 26, 2017

Can confirm! :) Thanks!

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

No branches or pull requests

2 participants