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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPE Crash in GeofencingTaskConsumer.didExecuteJob() #5191
Comments
How many cycles of opening/closing does it usually take for this to crash? I just tried to repro and wasn't able to get the crash to happen |
Charlie, thanks for taking a look. It's usually pretty quick for me after opening and closing a few times. I just crashed it several times, but I did have a couple of runs where I opened and closed it for a minute without crashing. Here's a video capture of a typical scenario: Out of curiosity what phone and OS version are you running? |
Pixel, Android 9 |
Hi Charlie. I assume you weren't able to reproduce on your end? We're still encountering this in our real app. Perhaps calling Either way, can you see how the Thanks again for checking this out. |
@briefjudofox Did you ever figure out a way to get around this issue? I just published an app running on SDK 35 and I'm getting a lot of crash reports exactly like yours. I took the app you created to reproduce this problem, updated it to the latest Expo version and I could still replicate the crash. So the issue still seems unresolved. |
Hi @vascoconde, I ended up ejecting and updating Thanks |
Yeah, thanks for the ping. I still haven't been able to repro a crash, but since you said sometimes it takes several hours or days to exhibit the crash, that would explain why I haven't seen it. @briefjudofox if you would like, you could open a PR or lay out the fix you've implemented to give @tsapeta a clear idea of the issue and your proposed solution |
Sounds good @cruzach. I'll try to pull something together soon. In the mean time, @tsapeta , I think my original post here mostly lays out the problem and potential fix so if you have time to take a look and it makes sense to you maybe you're able to make that change? Please lmk if you have other ideas. |
Hey @briefjudofox, |
Thanks @tsapeta & @Szymon20000 ! I appreciate it. |
Hey @tsapeta & @Szymon20000, thank you so much for taking a look at this issue. |
I am also seeing similar issues on Android (expo and standalone) when using Geofencing. Is there a way to fix this/get around this without ejecting at JavaScript level? |
I'm also facing similar problems. Any idea how to fix this? Caused by: java.lang.NullPointerException: |
same, I'm facing similar problems, any idea of a fix? |
FYI @tsapeta @Szymon20000 @cruzach I just created a PR for this. It's the solution outlined above. |
馃悰 Bug Report
Environment
Seems to be a problem on Android only. I've been testing on a Pixel 2 running Android 9.
Steps to Reproduce
If you're tailing the logs you should see:
Additional Context
In order to troubleshoot I ejected and added some additional logging and
null
checks toGeofencingTaskConsumer
:I noticed that the member variable
mTask
can be set to null bydidUnregister
whiledidExecuteJob
is still doing work so perhaps this is a thread safety issue?There may be a better way, but adding the
null
check and early return in the middle of the for loop did stop the crashing for me.Expected Behavior
The app should not crash when you restart a Geofence task by adding/removing regions, etc.
Actual Behavior
The app can crash when mTask is set to
null
whiledidExecuteJob
is still doing work.Reproducible Demo
I am unable to share our actual app, but here's a small app that I've used to reproduce this problem. Clone it, build and run it on your phone as a standalone app, and open and close it in quick succession. Note, that our actual app may run for several hours or even days without encountering this crash, but eventually it happens. Opening and closing quickly (or anything that would call
startAsync
on the task multiple times in a short amount of time ) seems to be the quickest way to reproduce.Thanks!
The text was updated successfully, but these errors were encountered: