Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nodejs/node
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d568efcd224fcc24b78581dcd587c834f24689d6
Choose a base ref
...
head repository: nodejs/node
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fbd5be673417680284a1e863ecfa54f8d52344c4
Choose a head ref
  • 20 commits
  • 33 files changed
  • 1 contributor

Commits on Apr 1, 2020

  1. src: introduce custom smart pointers for BaseObjects

    Referring to `BaseObject` instances using standard C++ smart pointers
    can interfere with BaseObject’s own cleanup mechanisms
    (explicit delete, delete-on-GC and delete-on-cleanup).
    
    Introducing custom smart pointers allows referring to `BaseObject`s
    safely while keeping those mechanisms intact.
    
    Refs: nodejs/quic#141
    Refs: nodejs/quic#149
    Reviewed-By: James M Snell <jasnell@gmail.com>
    
    Backport-PR-URL: #32301
    PR-URL: #30374
    Refs: nodejs/quic#165
    Reviewed-By: David Carlier <devnexen@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    c60780f View commit details
    Browse the repository at this point in the history
  2. http2: use custom BaseObject smart pointers

    Refs: nodejs/quic#141
    Reviewed-By: James M Snell <jasnell@gmail.com>
    
    Backport-PR-URL: #32301
    PR-URL: #30374
    Refs: nodejs/quic#149
    Refs: nodejs/quic#165
    Reviewed-By: David Carlier <devnexen@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    4745ac4 View commit details
    Browse the repository at this point in the history
  3. src: use BaseObjectPtr for keeping channel alive in dns bindings

    Backport-PR-URL: #32301
    PR-URL: #30374
    Refs: nodejs/quic#141
    Refs: nodejs/quic#149
    Refs: nodejs/quic#141
    Refs: nodejs/quic#165
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: David Carlier <devnexen@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    6db84d3 View commit details
    Browse the repository at this point in the history
  4. src: remove keep alive option from SetImmediate()

    This is no longer necessary now that the copyable `BaseObjectPtr`
    is available (as opposed to the only-movable `v8::Global`).
    
    Backport-PR-URL: #32301
    PR-URL: #30374
    Refs: nodejs/quic#141
    Refs: nodejs/quic#149
    Refs: nodejs/quic#141
    Refs: nodejs/quic#165
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: David Carlier <devnexen@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    e17d314 View commit details
    Browse the repository at this point in the history
  5. src: remove HandleWrap instances from list once closed

    This allows keeping `BaseObjectPtr`s to `HandleWrap` instances.
    Previously, the pointer kept the `HandleWrap` object alive, leaving
    the Environment cleanup code that waits for the handle list to drain
    in a busy loop, because only the `HandleWrap` destructor removed
    the item from the list.
    
    Refs: nodejs/quic#165
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
    
    Backport-PR-URL: #32301
    PR-URL: #30374
    Refs: nodejs/quic#141
    Refs: nodejs/quic#149
    Refs: nodejs/quic#141
    Reviewed-By: David Carlier <devnexen@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    5f95e69 View commit details
    Browse the repository at this point in the history
  6. src: keep object alive in stream_pipe code

    This was overlooked in a489583.
    
    Refs: #30374
    
    Backport-PR-URL: #32301
    PR-URL: #30666
    Fixes: #30643
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    7647bfe View commit details
    Browse the repository at this point in the history
  7. src: add more can_call_into_js() guards

    This is in preparation for running native `SetImmediate()`
    callbacks during shutdown.
    
    Backport-PR-URL: #32301
    PR-URL: #30666
    Fixes: #30643
    Refs: #30374
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    51230f7 View commit details
    Browse the repository at this point in the history
  8. src: no SetImmediate from destructor in stream_pipe code

    Guard against running `SetImmediate()` from the destructor.
    The object will not be alive or usable in the callback,
    so it does not make sense to attempt to schedule the
    `SetImmediate()`.
    
    Backport-PR-URL: #32301
    PR-URL: #30666
    Fixes: #30643
    Refs: #30374
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    5b65348 View commit details
    Browse the repository at this point in the history
  9. src: run native immediates during Environment cleanup

    This can be necessary, because some parts of the Node.js code base
    perform cleanup operations in the Immediate callbacks, e.g. HTTP/2.
    
    This resolves flakiness in an HTTP/2 test that failed when a
    `SetImmediate()` callback was not run or destroyed before the
    `Environment` destructor started, because that callback held a
    strong reference to the `Http2Session` object and the expectation
    was that no such objects exist once the `Environment` constructor
    starts.
    
    Another, slightly more direct, alternative would have
    been to clear the immediate queue rather than to run it. However,
    this approach seems to make more sense as code generally assumes
    that the `SetImmediate()` callback will always run; For example,
    N-API uses an immediate callback to call buffer finalization
    callbacks.
    
    Unref’ed immediates are skipped, as the expectation is generally
    that they may not run anyway.
    
    Fixes: #30643
    
    Backport-PR-URL: #32301
    PR-URL: #30666
    Refs: #30374
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    2625244 View commit details
    Browse the repository at this point in the history
  10. src: better encapsulate native immediate list

    Refactor for clarity and reusability. Make it more obvious that the
    list is a FIFO queue.
    
    Backport-PR-URL: #32301
    PR-URL: #31386
    Refs: openjs-foundation/summit#240
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    5df9698 View commit details
    Browse the repository at this point in the history
  11. src: exclude C++ SetImmediate() from count

    There is no real reason to manage a count manually, given that
    checking whether there are C++ callbacks is a single pointer
    comparison.
    
    This makes it easier to add other kinds of native C++ callbacks
    that are managed in a similar way.
    
    Backport-PR-URL: #32301
    PR-URL: #31386
    Refs: openjs-foundation/summit#240
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    aafb224 View commit details
    Browse the repository at this point in the history
  12. src: add a threadsafe variant of SetImmediate()

    Add a variant of `SetImmediate()` that can be called from any thread.
    This allows removing the `AsyncRequest` abstraction and replaces it
    with a more generic mechanism.
    
    Backport-PR-URL: #32301
    PR-URL: #31386
    Refs: openjs-foundation/summit#240
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    748a530 View commit details
    Browse the repository at this point in the history
  13. src: remove AsyncRequest

    Remove `AsyncRequest` from the source code, and replace its
    usage with threadsafe `SetImmediate()` calls. This has the
    advantage of being able to pass in any function, rather than
    one that is defined when the `AsyncRequest` is “installed”.
    
    This necessitates two changes:
    
    - The stopping flag (which was only used in one case and ignored
      in the other) is now a direct member of the `Environment` class.
    - Workers no longer have their own libuv handles, requiring
      manual management of their libuv ref count.
    
    As a drive-by fix, the `can_call_into_js` variable was turned
    into an atomic variable. While there have been no bug reports,
    the flag is set from `Stop(env)` calls, which are supposed to
    be possible from any thread.
    
    Backport-PR-URL: #32301
    PR-URL: #31386
    Refs: openjs-foundation/summit#240
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    7c2c068 View commit details
    Browse the repository at this point in the history
  14. src: add interrupts to Environments/Workers

    Allow doing what V8’s `v8::Isolate::RequestInterrupt()` does for V8.
    This also works when there is no JS code currently executing.
    
    Backport-PR-URL: #32301
    PR-URL: #31386
    Refs: openjs-foundation/summit#240
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    22bf867 View commit details
    Browse the repository at this point in the history
  15. src: move MemoryInfo() for worker code to .cc files

    This is a) the right thing to do anyway because these functions
    can not be inlined by the compiler and b) avoids compilation warnings
    in the following commit.
    
    Backport-PR-URL: #32301
    PR-URL: #31386
    Refs: openjs-foundation/summit#240
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    c2176e1 View commit details
    Browse the repository at this point in the history
  16. report: add support for Workers

    Include a report for each sub-Worker of the current Node.js instance.
    
    This adds a feature that is necessary for eventually making the report
    feature stable, as was discussed during the last collaborator summit.
    
    Refs: openjs-foundation/summit#240
    
    Backport-PR-URL: #32301
    PR-URL: #31386
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    87cfbb2 View commit details
    Browse the repository at this point in the history
  17. src: simplify native immediate queue running

    Make `SetImmediate()` behave more like `process.nextTick()`
    (which matches how we use it) by also running tasks that have been
    added during previous `SetImmediate()` calls.
    
    Backport-PR-URL: #32301
    PR-URL: #31502
    Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
    Reviewed-By: David Carlier <devnexen@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    cb16aab View commit details
    Browse the repository at this point in the history
  18. worker: move JoinThread() back into exit callback

    de2c68c moved this call to
    the destructor, under the assumption that that would essentially
    be equivalent to running it as part of the callback since the
    worker would be destroyed along with the callback.
    
    However, the actual code in
    `Environment::RunAndClearNativeImmediates()` comes with the subtlety
    that testing whether a JS exception has been thrown
    happens between the invocation of the callback and its destruction,
    leaving a possible exception from `JoinThread()` potentially
    unhandled (and unintentionally silenced through the `TryCatch`).
    
    This affected exceptions thrown from the `'exit'` event of the
    Worker, and made the `parallel/test-worker-message-type-unknown`
    test flaky, as the invalid message was sometimes only received
    during the Worker thread’s exit handler.
    
    Fix this by moving the `JoinThread()` call back to where it was
    before.
    
    Refs: #31386
    
    Backport-PR-URL: #32301
    PR-URL: #31468
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    c5de212 View commit details
    Browse the repository at this point in the history
  19. src: harden running native SetImmediate()s slightly

    Prevent mistakes like the one fixed by the previous commit
    by destroying the callback immediately after it has been called.
    
    Backport-PR-URL: #32301
    PR-URL: #31468
    Refs: #31386
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    56a4509 View commit details
    Browse the repository at this point in the history
  20. src: delete BaseObjectWeakPtr data when pointee is gone

    Fix the condition for deleting the underlying data pointed to by
    a `BaseObjectWeakPtr`, which erroneously skipped that deletion
    when `ptr->get()` was `nullptr`. This fixes a memory leak reported
    by some of the tests.
    
    Refs: #30374 (comment)
    
    Backport-PR-URL: #32301
    PR-URL: #32393
    Reviewed-By: Matheus Marchini <mat@mmarchini.me>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    addaleax authored and MylesBorins committed Apr 1, 2020
    Configuration menu
    Copy the full SHA
    fbd5be6 View commit details
    Browse the repository at this point in the history
Loading