-
Notifications
You must be signed in to change notification settings - Fork 29k
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_hooks initial implementation #8531
Commits on Jan 27, 2017
-
The async_wrap API will be changing substantially and breaking the existing API. So remove the current tests and add them back after they've been reimplemented.
Configuration menu - View commit details
-
Copy full SHA for 5d75ba4 - Browse repository at this point
Copy the full SHA 5d75ba4View commit details -
stream_base,tls_wrap: notify on destruct
Classes like TLSWrap hold a pointer to another StreamBase instance. The lifetime of these two are independent and allowed one to be retained while the other is cleaned up. In the case of TLSWrap, the private member TLSWrap::stream_ would be deleted, while the TLSWrap could still attempt to access it to see if it was alive. Give StreamBase a destruct callback to notify when the class is being cleaned up. Use this in TLSWrap to clear out the field.
Configuration menu - View commit details
-
Copy full SHA for 53a85f1 - Browse repository at this point
Copy the full SHA 53a85f1View commit details -
crypto: use named FunctionTemplate
RandomBytes and PBKDF2 were using the same "generic" ObjectTemplate for construction. Instead create one for each that is properly named.
Configuration menu - View commit details
-
Copy full SHA for 757ac35 - Browse repository at this point
Copy the full SHA 757ac35View commit details -
async_wrap: use more specific providers
Instead of wrapping several providers into PROVIDER_CRYPTO, have them all be named after their class. Rename other providers to also match their class names. With the exception of Parser. Which is actually HTTPParser. Add PROVIDER_LENGTH to make better checks in WrapperInfo().
Configuration menu - View commit details
-
Copy full SHA for 29e9d09 - Browse repository at this point
Copy the full SHA 29e9d09View commit details -
async_wrap: use double, not int64_t, for uid
The array math in JS converting the in64_t to a safe integer is unnecessary. Instead set the field to a double and allow internals direct access to the array to reduce overhead. Not ideal, but gets us the same number of values and simplifies the JS interface.
Configuration menu - View commit details
-
Copy full SHA for 82d8606 - Browse repository at this point
Copy the full SHA 82d8606View commit details -
async_wrap: add GetAsyncId() method
Allow handles to retrieve their own uid's by adding a new method on the FunctionTemplates. Implementation of these into all other classes will come in a future commit.
Configuration menu - View commit details
-
Copy full SHA for 4a427e3 - Browse repository at this point
Copy the full SHA 4a427e3View commit details -
src: add AsyncWrap::GetAsyncId() to all children
Add the method AsyncWrap::GetAsyncId() to all inheriting class objects so the uid of the handle can be retrieved from JS.
Configuration menu - View commit details
-
Copy full SHA for f5d6056 - Browse repository at this point
Copy the full SHA f5d6056View commit details -
async_wrap: only call SetupHooks() once
The call to async_wrap.setupHooks() will soon become an internal call. While other public APIs will be exposed through async_hooks. In preparation for this, only allow SetupHooks() to be called once. If called again, or if a non-function is passed, throw.
Configuration menu - View commit details
-
Copy full SHA for 1c9154c - Browse repository at this point
Copy the full SHA 1c9154cView commit details -
async_hooks: introduce async_hooks.js
Getting mechanics flushed out for both the necessary JS and C++ APIs. Currenty builds and runs, but complete implementation is coming.
Configuration menu - View commit details
-
Copy full SHA for 4c809dd - Browse repository at this point
Copy the full SHA 4c809ddView commit details -
async_hooks: check correct array
Check the correct array to see if hooks can be executed.
Configuration menu - View commit details
-
Copy full SHA for 3611f6a - Browse repository at this point
Copy the full SHA 3611f6aView commit details -
next_tick: add async_hooks support
Also did: * Turn TickObject() into a function * Split the function in half so it can be inlined * Fix how uid flags are set * Export kScopedTriggerId for use in setupInit()
Configuration menu - View commit details
-
Copy full SHA for d244d55 - Browse repository at this point
Copy the full SHA d244d55View commit details -
timers: initial timers support
Also change a couple things to retrieve the initTriggerId the same way in all cases.
Configuration menu - View commit details
-
Copy full SHA for 977718e - Browse repository at this point
Copy the full SHA 977718eView commit details -
fs: add initial async_hooks support
The placement of setting/updating the triggerId needs to be tested to make sure basic assumptions are met. Also fix propagation of the triggerId for fs.open(), remove adding information to the internal unordered_map for fs.openSync() and return the Float64Array to simplify usage.
Configuration menu - View commit details
-
Copy full SHA for 3e5ef64 - Browse repository at this point
Copy the full SHA 3e5ef64View commit details -
net: add initial async_hooks net support
cluster is still slightly messed up, as I figure out how to handle the "faux" handles passed to net.
Configuration menu - View commit details
-
Copy full SHA for 955d390 - Browse repository at this point
Copy the full SHA 955d390View commit details -
lib: add triggerId support to various modules
Properly propagate the triggerId in a few more modules.
Configuration menu - View commit details
-
Copy full SHA for da7c67c - Browse repository at this point
Copy the full SHA da7c67cView commit details -
http: reset Agents on free pool
Add function on native side to run AsyncWrap::Reset() from JS. Only add this to TCPWrap, since it's the only place necessary.
Configuration menu - View commit details
-
Copy full SHA for b3721ba - Browse repository at this point
Copy the full SHA b3721baView commit details -
src: properly propagate triggerId in more places
* Setup the currentId and triggerId during bootstrap. * Assign _asyncId and _triggerId on construction of Timeout * Always run emitBefore/emitAfter in timers to make sure ids are setup * Reset ids after after() hooks are called, not before
Configuration menu - View commit details
-
Copy full SHA for 78a2a7f - Browse repository at this point
Copy the full SHA 78a2a7fView commit details -
timers: manually set ids if no hooks exist
Instead of always calling into emitBefore/emitAfter, set the ids manually if there are no hooks to call. Better performance.
Configuration menu - View commit details
-
Copy full SHA for eab9e86 - Browse repository at this point
Copy the full SHA eab9e86View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4399547 - Browse repository at this point
Copy the full SHA 4399547View commit details -
async_hooks: allow enable/disable while processing
Safely enable()/disable() hooks while hooks are being processed. Otherwise the array length will change and hooks that should/shouldn't have been processed will be.
Configuration menu - View commit details
-
Copy full SHA for 830428a - Browse repository at this point
Copy the full SHA 830428aView commit details -
async_hooks: run after() in case of exception
In the case of an exception being caught by _fatalException(), make sure to always run the after() callbacks to let the user know the callback has completed. Include test to make sure after() is triggered correctly, including having the correct currentId.
Configuration menu - View commit details
-
Copy full SHA for ad382c5 - Browse repository at this point
Copy the full SHA ad382c5View commit details -
streams: set initTriggerId before nextTick()
Properly set the triggerId for the nextTick() call by using the _asyncId set on the stream.
Configuration menu - View commit details
-
Copy full SHA for 6e5af4a - Browse repository at this point
Copy the full SHA 6e5af4aView commit details -
next_tick: set MicrotaskCallback to the void
Point the _asyncId and _triggerId of the TickObject used by runMicrotasksCallback() to the void. When the PromiseHook API is implemented in V8 will address and properly propagate the ids.
Configuration menu - View commit details
-
Copy full SHA for 32b5288 - Browse repository at this point
Copy the full SHA 32b5288View commit details -
test: allow running with async_hook noops
Add NODE_TEST_WITH_ASYNC_HOOKS environment variable to allow running tests with init/before/after/destroy noops to make sure that basic mechanics work properly across all tests.
Configuration menu - View commit details
-
Copy full SHA for bd660a4 - Browse repository at this point
Copy the full SHA bd660a4View commit details -
async_hooks: move location of restoreTmpHooks()
Place restoreTmpHooks() closer to setupTmpActiveHooks() to make it more apparent what each is used for.
Configuration menu - View commit details
-
Copy full SHA for e8c27f8 - Browse repository at this point
Copy the full SHA e8c27f8View commit details -
async_wrap: use v8::Eternal for provider strings
Switch to using a v8::Eternal array to retrieve the provider strings passed as the "type" to the init() callback.
Configuration menu - View commit details
-
Copy full SHA for 0ab9547 - Browse repository at this point
Copy the full SHA 0ab9547View commit details -
fs: use preallocated Float64Array
Instead of always passing in a Float64Array to getIdsFromFd() preallocate one during initialization and write to those fields directly.
Configuration menu - View commit details
-
Copy full SHA for 352c89a - Browse repository at this point
Copy the full SHA 352c89aView commit details -
Configuration menu - View commit details
-
Copy full SHA for e9ae576 - Browse repository at this point
Copy the full SHA e9ae576View commit details -
async_hooks: verify stack integrity
When emitAfterS() is called, make sure the id passed in is the same id that's on the stack.
Configuration menu - View commit details
-
Copy full SHA for 015e665 - Browse repository at this point
Copy the full SHA 015e665View commit details -
async_hooks: place destroy ids on native list
destroy() hooks from JS should also be called async, but instead of trying to do this in a setImmediate, just use the same list that is used for native ids.
Configuration menu - View commit details
-
Copy full SHA for e2af82f - Browse repository at this point
Copy the full SHA e2af82fView commit details -
test: add more async hook tests
Add NODE_TEST_HANDLE_ACCESS, which tests if a resource aborts if inspected at the end of the process (specifically if the resource has been cleaned up on the C++ side), and NODE_CHECK_ASYNC_DESTROY, which checks if destroy has been called on the same id twice.
Configuration menu - View commit details
-
Copy full SHA for 1b7438f - Browse repository at this point
Copy the full SHA 1b7438fView commit details -
timers: don't reset _asyncId/_triggerId
This was originally done as a safety measure, but fails in practice if a clear*() is run on the same handle that's currently executing its callback.
Configuration menu - View commit details
-
Copy full SHA for ca8d6db - Browse repository at this point
Copy the full SHA ca8d6dbView commit details -
async_hooks: return early if emitting the void
In some cases, like triggering the microtask queue, there is no id (though that should change in the future). So instead trigger that execution is happening in the void, and return early if destroy is emitted on the void.
Configuration menu - View commit details
-
Copy full SHA for ac2e137 - Browse repository at this point
Copy the full SHA ac2e137View commit details -
async_hooks: really always exit on exception
async_hooks does not allow recovery from errors because it's currently unknown what will happen to the state of the application if that happens. So instead, force the application to print an error message then either exit or abort. Depending on whether the user passed --abort-on-uncaught-exception. exit() is used instead of reallyExit() to allow any 'exit' events to fire.
Configuration menu - View commit details
-
Copy full SHA for da138cf - Browse repository at this point
Copy the full SHA da138cfView commit details -
async_wrap: don't allow exports to be overwritten
ForceSet() everything with v8::ReadOnly | v8::DontDelete to make sure none of the object properties can be overridden.
Configuration menu - View commit details
-
Copy full SHA for 25dd8af - Browse repository at this point
Copy the full SHA 25dd8afView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2d98170 - Browse repository at this point
Copy the full SHA 2d98170View commit details -
PARTIAL implement new stack tracker
In order to get a stack tracker that is performant in JS had to do some ridiculous stuff. This allows the stack to be tracked from both C++ and JS with almost no overhead, and allows it to unwind properly in case there's a fatal exception.
Configuration menu - View commit details
-
Copy full SHA for 7bc7d3c - Browse repository at this point
Copy the full SHA 7bc7d3cView commit details -
Configuration menu - View commit details
-
Copy full SHA for edf67a7 - Browse repository at this point
Copy the full SHA edf67a7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 90f0a63 - Browse repository at this point
Copy the full SHA 90f0a63View commit details
Commits on Feb 2, 2017
-
async_wrap: print msg on error instead of abort
Instead of using a CHECK(), print an error message to the user. Check if --abort-on-uncaught-exception has been passed, and abort if this is the case. Otherwise exit(1).
Configuration menu - View commit details
-
Copy full SHA for 1ff2dfb - Browse repository at this point
Copy the full SHA 1ff2dfbView commit details