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

OutOfMemoryError with Shell.SU.available() #101

Open
ntoskrnl opened this issue Nov 20, 2020 · 1 comment
Open

OutOfMemoryError with Shell.SU.available() #101

ntoskrnl opened this issue Nov 20, 2020 · 1 comment

Comments

@ntoskrnl
Copy link

ntoskrnl commented Nov 20, 2020

I am developing an app that requires root for some of its features. Users sometimes set up periodic tasks to run. It seems to wok fine on rooted devices, but if device is not rooted I sometimes get OutOfMemoryError.

Before running command via threaded shell instance obtained by Shell.Pool.get(), I check root availability via Shell.SU.available().

I can't tell for sure that your library is the root cause of the problem though, but almost all crashes happen during creation of HandlerThread for Shell instance. In addition, I tried to execute Shell.SU.available() in a loop (once every 10 seconds) and watch thread count in profiler. Each execution spawns a new thread and it is never terminated.

I am going to cache the result of Shell.SU.available() somewhere, but I think it is still something that is worth looking into.

@ntoskrnl
Copy link
Author

After further investigation, I invoke Shell.SU.available() through RxJava on Shcedulers.io() and it seems that this method never returns.
I see the following lines in logcat:

...
D/libsuperuser: [libsuperuser][G][SU%] START
D/libsuperuser: [libsuperuser][P] newInstance(shell:su, pooled:1)
D/libsuperuser: [libsuperuser][G][SU%] START
D/libsuperuser: [libsuperuser][P] newInstance(shell:su, pooled:1)
D/libsuperuser: [libsuperuser][G][SU%] START
...

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

No branches or pull requests

1 participant