Skip to content
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

[v12.x backport] async_hooks: add AsyncLocalStorage #32318

Closed

Commits on Apr 14, 2020

  1. async_hooks: add executionAsyncResource

    Remove the need for the destroy hook in the basic APM case.
    
    Co-authored-by: Stephen Belanger <[email protected]>
    PR-URL: nodejs#30959
    Reviewed-By: Matteo Collina <[email protected]>
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: Chengzhong Wu <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    2 people authored and puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    8752332 View commit details
    Browse the repository at this point in the history
  2. async_hooks: executionAsyncResource matches in hooks

    Ensure that resource returned by executionAsyncResource() in before
    and after hook matches that resource causing this before/after calls.
    
    PR-URL: nodejs#31821
    Refs: nodejs#30959
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Minwoo Jung <[email protected]>
    Reviewed-By: Chengzhong Wu <[email protected]>
    Reviewed-By: Stephen Belanger <[email protected]>
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Flarna authored and puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    1f61d3c View commit details
    Browse the repository at this point in the history
  3. src: move InternalCallbackScope to StartExecution

    PR-URL: nodejs#31944
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Stephen Belanger <[email protected]>
    Reviewed-By: Joyee Cheung <[email protected]>
    codebytere authored and puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    adc1afb View commit details
    Browse the repository at this point in the history
  4. src: pass resource object along with InternalMakeCallback

    This was an oversight in 9fdb6e6.
    Fixing this is necessary to make `executionAsyncResource()` work
    as expected.
    
    Refs: nodejs#30959
    Fixes: nodejs#32060
    
    PR-URL: nodejs#32063
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: Stephen Belanger <[email protected]>
    Reviewed-By: Gireesh Punathil <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    addaleax authored and puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    288663c View commit details
    Browse the repository at this point in the history
  5. async_hooks: introduce async-context API

    Adding AsyncLocalStorage class to async_hooks
     module.
    This API provide a simple CLS-like set
    of features.
    
    Co-authored-by: Andrey Pechkurov <[email protected]>
    
    PR-URL: nodejs#26540
    Reviewed-By: Matteo Collina <[email protected]>
    Reviewed-By: Stephen Belanger <[email protected]>
    Reviewed-By: Gireesh Punathil <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    Reviewed-By: Michaël Zasso <[email protected]>
    vdeturckheim authored and puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    0807da3 View commit details
    Browse the repository at this point in the history
  6. async_hooks: add store arg in AsyncLocalStorage

    This commit introduces store as the first argument in
    AsyncLocalStorage's run methods. The change is motivated by the
    following expectation: most users are going to use a custom object
    as the store and an extra Map created by the previous implementation
    is an overhead for their use case.
    
    Important note. This is a backwards incompatible change.
    It was discussed and agreed an incompatible change is ok
    since the API is still experimental and the modified
    methods were only added within the last week so usage
    will be minimal to none.
    
    PR-URL: nodejs#31930
    Reviewed-By: Stephen Belanger <[email protected]>
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: Matteo Collina <[email protected]>
    Reviewed-By: Michaël Zasso <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    bedb27e View commit details
    Browse the repository at this point in the history
  7. test: improve disable AsyncLocalStorage test

    PR-URL: nodejs#31998
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    be305fe View commit details
    Browse the repository at this point in the history
  8. test: add GC test for disabled AsyncLocalStorage

    PR-URL: nodejs#31995
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Gireesh Punathil <[email protected]>
    Reviewed-By: Stephen Belanger <[email protected]>
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    ecc5935 View commit details
    Browse the repository at this point in the history
  9. async_hooks: fix ctx loss after nested ALS calls

    PR-URL: nodejs#32085
    Reviewed-By: Stephen Belanger <[email protected]>
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    5036117 View commit details
    Browse the repository at this point in the history
  10. async_hooks: add sync enterWith to ALS

    This allows transitioning the entire following sync and async execution
    sub-tree to the given async storage context. With this one can be sure
    the context binding will remain for any following sync activity and all
    descending async execution whereas the `run*(...)` methods must wrap
    everything that is intended to exist within the context. This is helpful
    for scenarios such as prepending a `'connection'` event to an http
    server which binds everything that occurs within each request to
    the given context. This is helpful for APMs to minimize the need
    for patching and especially adding closures.
    
    PR-URL: nodejs#31945
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: Matteo Collina <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    Qard authored and puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    e9b3918 View commit details
    Browse the repository at this point in the history
  11. test: add new scenario for async-local storage

    Add a new scenario of multiple clients sharing a single data
    callback function managing their response data through
    AsyncLocalStorage APIs
    
    Refs: nodejs#32063
    Refs: nodejs#32060
    Refs: nodejs#32062 (comment)
    
    Co-authored-by: Gireesh Punathil <[email protected]>
    
    PR-URL: nodejs#32082
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    HarshithaKP authored and puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    2e04161 View commit details
    Browse the repository at this point in the history
  12. benchmark: fix error on server close in AsyncLocalStorage benchmark

    PR-URL: nodejs#32503
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: Matteo Collina <[email protected]>
    Reviewed-By: Colin Ihrig <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    45ad080 View commit details
    Browse the repository at this point in the history
  13. async_hooks: prevent sync methods of async storage exiting outer context

    PR-URL: nodejs#31950
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: Gerhard Stöbich <[email protected]>
    Qard authored and puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    4cd19bc View commit details
    Browse the repository at this point in the history
  14. async_hooks: merge run and exit methods

    PR-URL: nodejs#31950
    Reviewed-By: Vladimir de Turckheim <[email protected]>
    Reviewed-By: Gerhard Stöbich <[email protected]>
    puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    c6f7f55 View commit details
    Browse the repository at this point in the history
  15. doc: improve AsyncLocalStorage sample

    PR-URL: nodejs#32757
    Reviewed-By: Michaël Zasso <[email protected]>
    Reviewed-By: Chengzhong Wu <[email protected]>
    Reviewed-By: Colin Ihrig <[email protected]>
    Reviewed-By: Gerhard Stöbich <[email protected]>
    Reviewed-By: Luigi Pinca <[email protected]>
    puzpuzpuz committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    fce0272 View commit details
    Browse the repository at this point in the history