-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
android_fopen.c freezing #571
Comments
I would need to ask to see what might be issue. AssetManager is from Java, could you make sure during the reading asset duration, the passed-in AssetManager is valid ( not removed by either jni/java side)? This program is small may not expose your usage scenario ( this is a guess ). It is a serious problem. |
The odd thing that it isn't always freezing. Just sometimes. Wasn't a problem in the past. We only use the main thread to access the native code. "the passed-in AssetManager is valid" I set it like so:
|
add a global reference to the passed in assetMgr, use that one, release it after fclose():
( it is a try, tbh ) |
Great thanks @ggfan
|
I’m using this c file to read files on the native side:
https://github.com/googlesamples/android-ndk/blob/master/native-media/app/src/main/cpp/android_fopen.c
Now we are getting plenty of ANRs in our app from this code - ~1700 ANRs a month.
Looks like the trouble is in “AAssetManager_open”.
This is the stack trace:
Using NDK r17c and Clang.
The text was updated successfully, but these errors were encountered: