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

src: do proper error checking in AsyncWrap::MakeCallback #21189

Closed

Commits on Jun 11, 2018

  1. src: do proper error checking in AsyncWrap::MakeCallback

    At least one method on a native object is added as a getter,
    namely `MessagePort.prototype.onmessage`. When a MessagePort
    attempts to call this method from C++ in response to receiving
    data, it will first invoke that getter and then call the function.
    
    Since `worker.terminate()` interrupts execution, this means
    that the getter may fail (without being faulty code on its own).
    This means that at least one test exercising these methods in
    combination has been flaky and could have crashed, because
    we did not actually check that the getter returns a value
    so far, resulting in dereferencing an empty `Local`.
    
    The proper fix for this is to use the non-deprecated overload
    of `Get()` and check the result like we should be doing.
    Also, as a (related) fix, don’t crash if the method
    is not a function but rather something else, like a getter
    could provide.
    
    Example test failure: https://ci.nodejs.org/job/node-test-commit-linux-containered/4976/nodes=ubuntu1604_sharedlibs_zlib_x64/console
    
        17:56:56 not ok 1955 parallel/test-worker-dns-terminate
        17:56:56   ---
        17:56:56   duration_ms: 1.237
        17:56:56   severity: crashed
        17:56:56   exitcode: -11
        17:56:56   stack: |-
    addaleax committed Jun 11, 2018
    Configuration menu
    Copy the full SHA
    bbc5258 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4bb9aac View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    032b390 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    c395973 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2018

  1. Configuration menu
    Copy the full SHA
    fa46748 View commit details
    Browse the repository at this point in the history