Skip to content

Instantly share code, notes, and snippets.

@othiym23
Created March 10, 2014 20:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save othiym23/9474014 to your computer and use it in GitHub Desktop.
Save othiym23/9474014 to your computer and use it in GitHub Desktop.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment