Uh oh!
There was an error while loading. Please reload this page.
async_hooks: triggerAsyncId can be undefined - #14387
Conversation
mcollina
commented
Jul 20, 2017
@nodejs/async_hooks @AndreasMadsen please verify. I do not claim this is the right fix or what other consequences this fix could have, but it solves the problem here. |
mcollina
commented
Jul 20, 2017
Side note: the commit does not pass |
mcollina
commented
Jul 20, 2017
This problem was likely introduced in #14026. |
We need to find the cause for why |
mcollina
commented
Jul 20, 2017
@AndreasMadsen the way 'shot' works is by piggypacking on core, and it does not allocate a full socket. https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L281 is expecting to have a real socket, but it has not in this case. I can write that test and default the value of that symbol to This change avoid all the crashes, at the cost of reporting bad data, why is it wrong? |
I agree. I suggested to @trevnorris that we skipped the entire assert in
Sounds reasonable. As far as I have seen the only two sources of error we have seen after |
I'll work on the other PR to null things in |
There was a problem hiding this comment.
I belive !Number.isSafeInteger(triggerAsyncId ) || triggerAsyncId < 0 is the "preferred" test
There was a problem hiding this comment.
If that is actually a valid code path
There was a problem hiding this comment.
If not, double equals would be preferred to combine both checks.
There was a problem hiding this comment.
Could be simplified to just if (triggerAsyncId == null) {
There was a problem hiding this comment.
heh... sorry, just spotted @mscdex's identical comment ;-)
mcollina
commented
Jul 20, 2017
@trevnorris what do you think of this? |
Change the statement to |
mcollina
commented
Jul 20, 2017
@trevnorris if you prefer this over #14389, I'll patch it right now. |
trevnorris
commented
Jul 20, 2017
jasnell
commented
Jul 20, 2017
@trevnorris ... I'm still trying to determine if this is the only one :-) need more coffee. If @mcollina is happy with it and it addresses the immediate need, then +1 |
mcollina
commented
Jul 20, 2017
I'm happy. I'll add a test also for #14368, so we don't regress on that as well. |
mcollina
commented
Jul 20, 2017
@trevnorris@addaleax@jasnell please review. I've included also a fix for: #14368. |
mcollina
commented
Jul 20, 2017
There was a problem hiding this comment.
Why this and not assert.strictEqual(chunk.toString(), 'hello world')?
There was a problem hiding this comment.
the chunk contains a full HTTP response, which for brevity I did not want to include. common.mustCall it's also sufficient to validate the test on its own.
There was a problem hiding this comment.
nit...
http.get(`http://localhost:${server.address().port}`);mcollina
commented
Jul 20, 2017
mcollina
commented
Jul 20, 2017
Fishrock123
commented
Jul 20, 2017
Fishrock123
commented
Jul 20, 2017
Uh oh, these work just fine on |
Hmmmm, that might be flakey. I can't repo it now. |
refack
commented
Jul 20, 2017
Stress on linuxONE: https://ci.nodejs.org/job/node-stress-single-test/1336/nodes=rhel72-s390x/ |
I stress tested against master locally. It's flaky: $ tools/test.py -j92 --repeat 920 test/async-hooks/test-tlswrap.js === release test-tlswrap === Path: async-hooks/test-tlswrapassert.js:43 throw new errors.AssertionError({ ^AssertionError [ERR_ASSERTION]: Checking invocations at stage "client: when client destroyed": Called "before" 2 time(s), but expected 3 invocation(s). at checkHook (/Users/trott/io.js/test/async-hooks/hook-checks.js:51:14) at Array.forEach (<anonymous>) at checkInvocations (/Users/trott/io.js/test/async-hooks/hook-checks.js:28:44) at tick1 (/Users/trott/io.js/test/async-hooks/test-tlswrap.js:93:5) at Immediate.ontick (/Users/trott/io.js/test/async-hooks/tick.js:7:37) at runCallback (timers.js:781:20) at tryOnImmediate (timers.js:743:5) at processImmediate [as _immediateCallback] (timers.js:714:5)Command: out/Release/node /Users/trott/io.js/test/async-hooks/test-tlswrap.jsProbably race condition. The comment around before line 93 (where the test fails) kind of suggests that too: // TODO: why is client not destroyed here even after 5 ticks?// or could it be that it isn't actually destroyed until// the server is closed? |
PR-URL: nodejs/node#15454 Ref: nodejs/node#14387 Ref: nodejs/node#14722 Ref: nodejs/node#14717 Ref: nodejs/node#15448 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs/node#15454 Ref: nodejs/node#14387 Ref: nodejs/node#14722 Ref: nodejs/node#14717 Ref: nodejs/node#15448 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Fixes: #14386
Fixes: #14381
Fixes: #14368
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
async_hooks