You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/02/20 22:19:53 UTC

[GitHub] [skywalking-nodejs] tom-pytel commented on pull request #27: use invalid to check asyncState

tom-pytel commented on pull request #27:
URL: https://github.com/apache/skywalking-nodejs/pull/27#issuecomment-782758076


   > Just saw I was tagged in here. I just wanted to say, as the author of `store.enterWith(...)`, I highly recommend against using it in this way. It has one very specific use case, and is marked as such in the docs, which is to inject it before an http handler to have the entire remainder of the currently executing tick to be attributed to the given context. This is almost never what you actually want. In looking at how you're using it here, it should pretty much always be done with `store.run(...)` to properly escape the context attribution at the correct boundary. Otherwise you are likely to leak the context into places you might not expect or to switch contexts more than once in the same context which could also have strange behaviour.
   > 
   > The official interface is `store.run(...)` and I would highly recommend only ever using that unless you are absolutely _certain_ `store.enterWith(...)` is the only solution and you fully understand the implications of using it.
   
   Well, apart from this bug so far it seems to be working ok after some stress testing we did. `store.run()` doesn't work in the manner we need this to work, I am not trying to run a subtask but set a new context. The idea being that at the point where `store.enterWith()` is executed the context variable for this task and all asynchronous child tasks created chronologically after the `enterWith()` get the new context variables. I understand it may have been created for the niche case you describe, but are you saying that it will break for the desired behavior I described in some cases?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org