-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Stop RecordingApmServer message processing before returning from tests #130007
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
Conversation
Pinging @elastic/es-core-infra (Team:Core/Infra) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, though wondering if it wouldn't be easier to reason if instead handling IOExceptions
...egration/src/javaRestTest/java/org/elasticsearch/test/apmintegration/RecordingApmServer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused how this addresses the linked failure. I thought the problem was the apm agent continues to run in the background, so requests to the recording server begin failing. Can you explain how this change fixes the issue?
Turned out that the issue is that the APM agent is in the middle of writing, ES gets shut down, the connection breaks, the mock APM server throws. |
@mosche I've decided to go with your suggestion; I tried to refactor the RecordingApmServer to better coordinate the APM mock server and the ES cluster, but it's error prone and I was not satisfied. So better to go with the minimalist and more robust solution, at least until we stay with the APM agent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍
The RecordingApmServer needs to be started before the ElasticsearchCluster; however, it needs to be stopped (or, at least, it needs stopping processing messages) before the ElasticsearchCluster.
JUnit rules do process before/after in reverse order at startup/shutdown; using a RuleChain slightly improves the situation (as opposed to today's ClassRule + Rule), but does not solve the issue.
Here I am introducing an additional "stop" method; the method needs to be called explicitly at the end of the test, but this way we can make RecordingApmServer stop processing requests before the ElasticsearchCluster is gone and communication is interrupted exceptionally.
Fixes #129651