-
Notifications
You must be signed in to change notification settings - Fork 272
Skip empty Java paths in POLYMC_JAVA_PATHS #1696
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
base: develop
Are you sure you want to change the base?
Conversation
Do you know what causes that? Because surely if the path is empty from some other mistake that still shouldn't happen. Feels like this fix is targeting the wrong part of the code, or at least the underlying problem should also be fixed in addition to this. |
Seems to be something else, actually. On my machine, the launcher tries to spawn 1490 Java checkers, and a timeout happened with a non-empty path. It's possible that the launcher is just spawning too many processes and hitting some limit. |
Would prefer as another commit to this PR. |
On second thought, this issue only really affects the Linux Java detection code, which blindly considers an excessive number of locations instead of checking a more limited set like on Windows and macOS. |
Looking at |
@byte-chan Why is it expected to fail 1481 times? Also should I merge the PR now? Idk whether your look into the issue with strace made you think of changing anything with it. |
Current Yes, the PR should be good to merge now. |
If POLYMC_JAVA_PATHS is empty or unset, the Java checker tries to check an empty path for a valid Java binary. This has the undesirable effect of potentially attempting to kill a process with PID -1, or every process for which the launcher has permission to send signals. Signed-off-by: byte-chan™ <baumi@bytesoft.dev>
Instead of blindly spawning a potentially excessive number of processes, nonexistent or non-executable paths could be skipped by checking the path returned by FS::ResolveExecutable. If it returns an empty string, the path does not resolve to an executable file and can be skipped. On Linux, this change dramatically speeds up the Java auto-detection. Signed-off-by: byte-chan™ <baumi@bytesoft.dev>
If
POLYMC_JAVA_PATHS
is empty or unset, the Java checker tries to check an empty path for a valid Java binary. This has the undesirable effect of potentially attempting to kill a process with PID -1, or every process for which the launcher has permission to send signals.