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

android-studio: add ps to closure #85719

Merged
merged 1 commit into from Apr 21, 2020
Merged

Conversation

nioncode
Copy link
Member

Motivation for this change

When killing processes, android-studio uses ps to figure out which sub-processes to kill (see https://github.com/JetBrains/intellij-community/blob/902d4d89a3f630c80d5e252214dee48098c169ae/platform/util/src/com/intellij/execution/process/UnixProcessManager.java#L224). Without ps in the closure, this fails and the process is never killed.
android-studio then prints the following error to stderr:

2020-04-21 08:23:25,287 [3428731]   WARN - ion.process.UnixProcessManager - Error killing the process 
java.lang.IllegalStateException: IDE pid is not found in ps list(13567)
	at com.intellij.execution.process.UnixProcessManager.findChildProcesses(UnixProcessManager.java:194)
	at com.intellij.execution.process.UnixProcessManager.sendSignalToProcessTree(UnixProcessManager.java:141)
	at com.intellij.execution.process.UnixProcessManager.sendSignalToProcessTree(UnixProcessManager.java:129)
	at com.intellij.execution.process.UnixProcessManager.sendSignalToProcessTree(UnixProcessManager.java:117)
	at com.intellij.execution.process.UnixProcessManager.sendSigKillToProcessTree(UnixProcessManager.java:112)
	at com.intellij.execution.process.OSProcessUtil.killProcessTree(OSProcessUtil.java:54)
	at com.intellij.execution.process.impl.OSProcessManagerImpl.killProcessTree(OSProcessManagerImpl.java:20)
	at com.intellij.execution.process.OSProcessHandler.killProcessTreeSync(OSProcessHandler.java:221)
	at com.intellij.execution.process.OSProcessHandler.lambda$killProcessTree$0(OSProcessHandler.java:215)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

When killing processes, android-studio uses `ps` to figure out which
subprocesses to kill. Without `ps` in the closure, this fails and the
process is never killed.
Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for the fix and the very nice documentation :)
(I even learnt that we prefer ps over procps for such cases.)

Edit: Backported to 20.03 in 9ee1172.
Edit2: And of course thanks for your review @prusnak :)

@primeos primeos merged commit b9c027d into NixOS:master Apr 21, 2020
primeos pushed a commit that referenced this pull request Apr 21, 2020
When killing processes, android-studio uses `ps` to figure out which
subprocesses to kill. Without `ps` in the closure, this fails and the
process is never killed.

(cherry picked from commit c296bf7)
Reason: Fixes a bug, see #85719.
@nioncode nioncode deleted the android-studio-ps branch April 22, 2020 06:39
stigok pushed a commit to stigok/nixpkgs that referenced this pull request Jun 12, 2020
When killing processes, android-studio uses `ps` to figure out which
subprocesses to kill. Without `ps` in the closure, this fails and the
process is never killed.

(cherry picked from commit c296bf7)
Reason: Fixes a bug, see NixOS#85719.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants