mutex between async samples#43
Merged
Merged
Conversation
Contributor
Contributor
|
🔧 Report generated by pr-comment-scanbuild Scan-Build Report
Bug Summary
Reports
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
jbachorik
approved these changes
Nov 14, 2023
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?:
This makes two changes:
Motivation:
We have seen infrequent segfaults in high load services internally with the following stacktrace:
This is caused by dereferencing a null pointer (
si_addr: 0x0000000000000000).I inspected the libjvm build using the docker images Azul publish (currently docker
azul/zulu-openjdk:17-latestcan be used to obtain a 17.0.9+8 build). After installing binutils,objdump -d /usr/lib/jvm/zulu17-ca-amd64/lib/server/libjvm.socan be used to find disassembly for the function where the segfault takes place:(note that 0x6cbfa0 + 0x115 = 0x6cc0b5). The line above the faulting instruction (6cc0b0) is jumped to from 6cbfc4 and 6cbfd2 before jumping back to 6cbfd8. These checks appear to be checks inlined from the function
JavaFrameAnchor::make_walkable()shown below:_last_Java_spis anvolatile intptr_t*and_last_Java_sp[-1]is the address 8 bytes before it, which is consistent with the x86mov -0x8(%rax),%rax.The only problem is that
last_Java_sp()was already actually null-checked a few lines above! So_last_Java_pcwas somehow made null during the execution of this function. There are two possibilities:AsyncGetCallTrace(either the perf events CPU profiler or the wallclock profiler) from the other one while the thread was inJavaFrameAnchor::make_walkable(). The TLS based mutex would prevent this, and we will know if this is effective if the crashes we see stop.last_Java_spto null during the invocation of the function. We will consider this possibility if the crashes recur.The second commit is to allow better diagnostics in case this crash happens exclusively in a retry call and could have been avoided without the workaround.
Additional Notes:
How to test the change?:
For Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance.Unsure? Have a question? Request a review!