Fix runtime attach for current user#1819
Merged
SylvainJuge merged 6 commits intoelastic:masterfrom May 20, 2021
Merged
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
felixbarny
reviewed
May 18, 2021
apm-agent-attach-cli/src/main/java/co/elastic/apm/attach/UserRegistry.java
Outdated
Show resolved
Hide resolved
…pm-agent-java into wip-fix-for-runtime-attach
eyalkoren
approved these changes
May 20, 2021
felixbarny
reviewed
May 25, 2021
apm-agent-attach-cli/src/main/java/co/elastic/apm/attach/UserRegistry.java
Show resolved
Hide resolved
apm-agent-attach-cli/src/test/java/co/elastic/apm/attach/UserRegistryTest.java
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
When using runtime attach as
rootuser, it seems that in some circumstances the attach process hangs likely due to asudointeractive input. In this case, the target JVM also runs asroot, thus trying to usesudois not even required at all.When this happens with agent
1.23.0, the following stack trace is visible in a thread dump:What this PR does (at least as time of writing) is just making sure that we do not use
sudowhenever the current user is already the one from the target JVM. Fixing the blocking behavior will be a second step.Checklist
adding a timeout when waiting forsudoexecution to prevent such blocking behavior + properly log the issue--> not doable as
waitForwith timeout variant has been added in Java 8.