-
-
Notifications
You must be signed in to change notification settings - Fork 15
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] read() and readFile() lead to "A resource failed to call close" #10
Comments
Hey @raphaelheinz , thanks for reporting.
Yeah... there are lots of minor inconsistencies and bugs in the original library, also inherited into my fork.
No, I haven't noticed it, but had no chance to carefully test everything either.
I guess, it just requires a fix in this function implementation for Android (and perhaps other functions may have the same issue): react-native-fs/android/src/main/java/com/drpogodin/reactnativefs/ReactNativeFsModule.java Lines 535 to 555 in fc86f09
☝️ Looking at the code, and your warning, I guess it should close the file stream at function exit, but it never does. |
Thanks for your input! I can confirm that this was indeed the issue. After closing the file in the Android native module, the warning has disappeared. If you like, I can submit a pull request after work :) |
It will be awesome if you do :) |
Hello, @birdofpreyru it also doesn't close on ios as well. When I read chunks in a loop, the memory consumption just keeps on getting higher and higher. Sadly, I couldn't figure out how to close the file on my own. |
@ISnowFoxI this does not sound surprising to me. I created a new issue to track it (#12), though no idea when I'll have capacity to look into it. |
Hi @birdofpreyru,
thanks for taking over the maintenance of this library. We appreciate your time and effort.
Currently, I am facing a problem that is also reproducible with the original library. I would like to read a large file (>20MB) in Android and for performance reasons I read it in chunks within a for-loop.
Unfortunately a lot of Android system warnings are logged in the loop:
A resource failed to call close.
Are you aware of this problems? I do not feel comfortable releasing my app which contains tons of such warnings. Can I close the file manually to prevent this warning? Or do you recommend other techniques for my use case?
Thanks very much!
The text was updated successfully, but these errors were encountered: