Repository: node
Issue: Different behavior of async_hooks between Node 10 and 12 version
Labels: async_hooks

* **Version**: v10.16.3 and v12.9.0
* **Platform**: 4.15.0-58-generic #64~16.04.1-Ubuntu x86_64 GNU/Linux
* **Subsystem**: async_hooks

Hello,
I've come into an issue while testing simple CLS storage using async_hooks. On Node 10 following code works correctly and execution context can be followed, but after upgrading to Node 12 it will fail with assertion error and I'm not able to follow promise execution.

### Test code
```js
const AsyncHooks = require('async_hooks');
const Fs = require('fs');
const Assert = require('assert');

const ctx = new Map();
const hook = AsyncHooks.createHook({
    init(asyncId, type, triggerAsyncId) {
        log(`${type}(${asyncId}):`, 'trigger:', triggerAsyncId, 'execution:', AsyncHooks.executionAsyncId());
        if (ctx.has(triggerAsyncId)) {
            ctx.set(asyncId, ctx.get(triggerAsyncId));
        }
    },
    destroy(asyncId) {
        log(`destroy(${asyncId}):`, 'trigger:', AsyncHooks.triggerAsyncId(), 'execution:', AsyncHooks.executionAsyncId());
        ctx.delete(asyncId);
    },
    promiseResolve(asyncId) {
        log(`resolve(${asyncId}):`, 'trigger:', AsyncHooks.triggerAsyncId(), 'execution:', AsyncHooks.executionAsyncId());
        ctx.delete(asyncId);
    }
});

(async () => {
    hook.enable();
    const context = 888;
    scope(context);
    await async();
    Assert.equal(get(), undefined);

    async function async() {
        Assert.equal(get(), context);
        const nestedContext = 999;
        scope(nestedContext);
        Assert.equal(get(), nestedContext);
        await async2(nestedContext);
        Assert.equal(get(), context);
    }

    async function async2(nestedContext) {
        Assert.equal(get(), nestedContext);
        await Promise.resolve();
        Assert.equal(get(), nestedContext);
    }
})();

function scope(context) {
    ctx.set(AsyncHooks.executionAsyncId(), context);
}

function get() {
    return ctx.get(AsyncHooks.executionAsyncId());
}

function log(...args) {
    Fs.writeSync(1, args.join(' '));
    Fs.writeSync(1, '\n');
}
```
### Node 10 output
```
PROMISE(5): trigger: 1 execution: 1
PROMISE(6): trigger: 1 execution: 1
PROMISE(7): trigger: 1 execution: 1
resolve(7): trigger: 0 execution: 1
PROMISE(8): trigger: 6 execution: 1
PROMISE(9): trigger: 8 execution: 1
resolve(8): trigger: 0 execution: 1
PROMISE(10): trigger: 5 execution: 1
PROMISE(11): trigger: 10 execution: 1
resolve(10): trigger: 0 execution: 1
PROMISE(13): trigger: 12 execution: 1
PROMISE(14): trigger: 13 execution: 1
resolve(13): trigger: 0 execution: 1
PROMISE(15): trigger: 7 execution: 1
PROMISE(16): trigger: 6 execution: 1
PROMISE(17): trigger: 5 execution: 1
resolve(8): trigger: 7 execution: 15
resolve(15): trigger: 7 execution: 15
resolve(6): trigger: 8 execution: 9
resolve(9): trigger: 8 execution: 9
resolve(10): trigger: 6 execution: 16
resolve(16): trigger: 6 execution: 16
resolve(5): trigger: 10 execution: 11
resolve(11): trigger: 10 execution: 11
resolve(13): trigger: 5 execution: 17
resolve(17): trigger: 5 execution: 17
resolve(12): trigger: 13 execution: 14
resolve(14): trigger: 13 execution: 14
```
### Node 12 output
```
PROMISE(2): trigger: 1 execution: 1
PROMISE(3): trigger: 1 execution: 1
PROMISE(4): trigger: 1 execution: 1
resolve(4): trigger: 0 execution: 1
PROMISE(5): trigger: 4 execution: 1
PROMISE(6): trigger: 3 execution: 1
PROMISE(7): trigger: 2 execution: 1
TTYWRAP(8): trigger: 5 execution: 5
SIGNALWRAP(9): trigger: 5 execution: 5
resolve(3): trigger: 4 execution: 5
resolve(5): trigger: 4 execution: 5
resolve(2): trigger: 3 execution: 6
resolve(6): trigger: 3 execution: 6
resolve(10): trigger: 2 execution: 7
resolve(7): trigger: 2 execution: 7
TickObject(11): trigger: 1 execution: 1
TickObject(12): trigger: 1 execution: 1
TickObject(13): trigger: 1 execution: 1
(node:32753) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: undefined == 999
    at async2 (/home/jan/Documents/CODE/tuma-test/migration/async-hooks/hooks.js:42:16)
    at async async (/home/jan/Documents/CODE/tuma-test/migration/async-hooks/hooks.js:35:9)
    at async /home/jan/Documents/CODE/tuma-test/migration/async-hooks/hooks.js:27:5
TickObject(14): trigger: 11 execution: 11
(node:32753) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
TickObject(15): trigger: 12 execution: 12
(node:32753) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
TickObject(16): trigger: 13 execution: 13
destroy(11): trigger: 0 execution: 0
destroy(12): trigger: 0 execution: 0
destroy(13): trigger: 0 execution: 0
destroy(14): trigger: 0 execution: 0
destroy(15): trigger: 0 execution: 0
destroy(16): trigger: 0 execution: 0
```