Skip to content

Kill leftover guest processes when the app starts - #317

Open
ytgs5148 wants to merge 1 commit into
SimonSchubert:mainfrom
ytgs5148:kill-leftover-guest-processes
Open

ytgs5148 wants to merge 1 commit into
SimonSchubert:mainfrom
ytgs5148:kill-leftover-guest-processes

Conversation

@ytgs5148

Copy link
Copy Markdown

On my phone Omalauncher shows about 6 hours in the background and 2 hours of CPU with the screen on for a few minutes.

Now and then the Linux session gets killed and restarted while the app stays alive. A widget shell (bash --noprofile --norc) from the old session is left behind with parent PID 1. It sits at about 100% CPU until I force-stop the app or reboot. It also has a defunct head child, which looks like the | head -c in GuestShell. I logged this for a few days: 15 to 40 times a day, and every leftover had libproot-loader.so as its executable.

ProcessTree.kt already says that when a proot is SIGKILLed, its processes keep running untraced and spin. Proot.killAll() cleans up exactly these, but it only runs when Linux is stopped or removed. Nothing calls it when the app starts, so leftovers from the previous run stay.

This calls proot.killAll() once at the start of Runtime's init. The app has a single process and no proot exists yet at that point, so everything it finds is a leftover.

I haven't built this or run it on a device, so none of the checklist below is ticked. I also don't know what kills the proot in the first place, only that the leftovers are never cleaned up afterwards.

  • ./gradlew :owl:test :app:testFossDebugUnitTest :owl:owlJar :app:assembleFossDebug :app:lintFossDebug passes
  • Tried on a device or emulator

@ytgs5148

ytgs5148 commented Nov 19, 2026 •

Copy link
Copy Markdown
Author

bumping this @SimonSchubert this is causing huge cpu usage and battery drain 😄

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

Successfully merging this pull request may close these issues.

1 participant