Here is what continuation-local-storage
is expecting from async-listener:
(scenario: three asynchronous / calls in a single continuation chain)
create[1]
|
|
before[1]
| create[2]
after[1] |
|
before[2]
| create[3]
after[2] |
|
before[3]
|
after[3]
In order for the contexts to be set up correctly to pass state through the continuation chain, each subsequent continuation has to be able to get at the context set by the previous ones. Therefore, each create
callback has to be run after the previous before
callback, and before the previous after
callback.
Unfortunately both the current version of the asyncListener API and the stripped-down minimal tracing API do not preserve this behavior with network calls, because of the split between object instantiation and handle allocation. In some circumstances, create
is getting called outside the before
-after
pairs.