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

fix: Fix Frame Processor null-dereference error (use ref-counted JNI local_ref) #351

Merged
merged 1 commit into from
Aug 20, 2021

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Aug 11, 2021

What

With #350 it looks like a null-pointer has been tried to access. This happens randomly, after maybe 5 mins or so.

My gut feeling tells me that this is the Java garbage collector running exactly at the point where a frame processor is being invoked, and since we only pass the frame, the parameters and the return values as alias_ref (non-ref counted pointers), Java thinks it can delete those values. Now I tried using a thread specific ref-counted pointer (local_ref) and it seems like everything is working - need feedback from #350's OP first though.

Changes

Tested on

Related issues

@mrousavy mrousavy added 🐛 bug Something isn't working 🤖 android Issue affects the Android platform labels Aug 11, 2021
@mrousavy mrousavy changed the title fix: Fix Frame Processor null-dereference error (use ref-counted JNI … fix: Fix Frame Processor null-dereference error (use ref-counted JNI local_ref) Aug 11, 2021
@rodgomesc
Copy link
Contributor

works like a charm \o/

@mrousavy
Copy link
Owner Author

are you sure? did you test it long enough? can't believe that did the trick

@mrousavy mrousavy merged commit d06bcf6 into main Aug 20, 2021
@mrousavy mrousavy deleted the fix/null-pointer-local.reference-error branch August 20, 2021 13:57
@rodgomesc
Copy link
Contributor

me neither, it's been running for about 15 minutes now

mrousavy added a commit that referenced this pull request Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Issue affects the Android platform 🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 FrameProcessor crash on Android
2 participants