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

[async_wrap] call destroy hooks on uv_timer_t #13369

Merged
merged 2 commits into from
Jun 2, 2017

Commits on Jun 2, 2017

  1. async_wrap: run destroy in uv_timer_t

    Calling the destroy callbacks in a uv_idle_t causes a timing issue where
    if a handle or request is closed then the class isn't deleted until
    uv_close() callbacks are called (which happens after the poll phase).
    This results in some destroy callbacks not being called just before the
    application exits. So instead switch the destroy callbacks to be called
    in a uv_timer_t with the timeout set to zero.
    
    When uv_run() is called with UV_RUN_ONCE the final operation of the
    event loop is to process all remaining timers. By setting the timeout to
    zero it results in the destroy callbacks being processed after
    uv_close() but before uv_run() returned. Processing the destroyed ids
    that were previously missed.
    
    Also, process the destroy_ids_list() in a do {} while() loop that makes
    sure the vector is empty before returning. Which also makes running
    clear() unnecessary.
    
    Fixes: nodejs#13262
    PR-URL: nodejs#13369
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Andreas Madsen <[email protected]>
    trevnorris committed Jun 2, 2017
    Configuration menu
    Copy the full SHA
    1e44fd9 View commit details
    Browse the repository at this point in the history
  2. test: check destroy hooks are called before exit

    Verify that the destroy callback for a TCP server is called before exit
    if it is closed in another destroy callback.
    
    Fixes: nodejs#13262
    PR-URL: nodejs#13369
    Reviewed-By: Trevor Norris <[email protected]>
    Reviewed-By: Andreas Madsen <[email protected]>
    addaleax authored and trevnorris committed Jun 2, 2017
    Configuration menu
    Copy the full SHA
    78b1358 View commit details
    Browse the repository at this point in the history