-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Response headers aren't merged across responding threads #99927
Comments
Pinging @elastic/es-core-infra (Team:Core/Infra) |
I've thought about this issue a bit more. I think the task framework can provide a solution without requiring changes in other places. The parent task should collect and merge response headers from its child tasks. While it may not be a complete solution, it's an appealing option due to its contained nature. I'm tagging the @elastic/es-distributed team for their awareness. |
It seems to me that threadContext management is an explicit choice of the caller. The ThreadContext class provides an array of methods so that request and response headers can be preserved or dropped. Therefore baking response header merging into the task framework seems to be too coarse grained. Would either |
I was wondering if it should be even lower-level: anywhere that we fan-in responses could potentially need to combine response headers from different thread contexts. There's various fundamental fan-in mechanisms, including |
We have implemented elastic#99927 in DriverRunner. However, we also need to implement this in ComputeService, where we spawn multiple requests to avoid losing response headers. Relates elastic#99927 Closes elastic#100163 Closes elastic#102982 Closes elastic#102871 Closes elastic#103028
This is related to #99926.
It seems that our infrastructure does not merge response headers across multiple asynchronous calls. Response headers are not merged properly in this scenario:
The caller initiates two asynchronous calls, c1 and c2, which can involve network requests.
c1 responded with a warning in the header responses. We merge these response headers with the original ThreadContext of the calling thread and update the ThreadContext of the current thread while leaving the ThreadContext of the calling thread untouched.
c2 responded with no warning in the header responses. Since the original ThreadContext of the calling thread did not get updated after c1, as it's immutable, we won't be able to merge response headers between c1 and c2.
The caller receives a response from the responding thread of c2 without any warning
The text was updated successfully, but these errors were encountered: