-
Notifications
You must be signed in to change notification settings - Fork 29.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
http2: Async resource store is not applied on 'response' event #55376
Comments
Try updating the
|
@Mian-Ahmed-Raza Thank you. This is a possible workaround, but it is obviously not a solution. In my case, I don't call http2 directly, I use grpc-js, which internally uses http2. I have no control over the way the library connects to the events. |
By the way, if I initialize the client itself with async store, this value is shown for let client;
asyncLocalStorage.run({ session: 0 }, () => {
client = connect('http://localhost:9443')
}); Output:
|
To maintain the correct session context throughout the request-response lifecycle, you need to ensure that both the client creation and the requests are encapsulated within the same
|
Once again, I'm not using http2 directly. This is the relevant part in grpc-js: Do you suggest that I hook in it? How? |
I understand that you're using
If the issue persists and you're finding it challenging to maintain the context, it may be worth exploring the source code of grpc-js. This could help you understand how it manages its internal HTTP/2 connections and whether there are hooks or extensions available that could allow for better context handling. |
But I need all the google-cloud/google-gax/grpc logic, I'm not going to implement all of it because of a bug in node. |
I realize my notes may have come across as offensive, and I truly appreciate your help. I had no intention of causing any offense. I'll try to debug node and propose a solution. This issue is similar to #41285. |
None of the events of |
Hi @mcollina, For Line 911 in 0f375db
Could it be that something as simple as that is missing for Because it sounds to me that keeping the context in "request-response" protocols that are implemented in core should occur on core and not on the client code. |
While I agree in principle, very little of core is designed for that purpose. |
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes nodejs#55376
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: nodejs#55376
Proposed fix: |
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: nodejs#55376
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: nodejs#55376
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: nodejs#55376
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: nodejs#55376
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: nodejs#55376
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: #55376 PR-URL: #55460 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: #55376 PR-URL: #55460 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: nodejs#55376 PR-URL: nodejs#55460 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: nodejs#55376 PR-URL: nodejs#55460 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: #55376 PR-URL: #55460 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: #55376 PR-URL: #55460 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Create and store an AsyncResource for each stream, following a similar approach as used in HttpAgent. Fixes: #55376 PR-URL: #55460 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Version
22.9.0
Platform
Subsystem
http2
What steps will reproduce the bug?
server.mjs:
client.mjs:
Output:
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
The async store should be applied also on response
What do you see instead?
It's not.
Additional information
No response
The text was updated successfully, but these errors were encountered: