async_hooks: triggerAsyncId can be undefined#14387
async_hooks: triggerAsyncId can be undefined#14387mcollina wants to merge 2 commits intonodejs:masterfrom
Conversation
|
@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. |
|
Side note: the commit does not pass |
|
This problem was likely introduced in #14026. |
We need to find the cause for why |
|
@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 |
lib/internal/process/next_tick.js
Outdated
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 ;-)
|
@trevnorris what do you think of this? |
|
Change the statement to |
|
@trevnorris if you prefer this over #14389, I'll patch it right now. |
|
@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 |
|
I'm happy. I'll add a test also for #14368, so we don't regress on that as well. |
|
@trevnorris @addaleax @jasnell please review. I've included also a fix for: #14368. |
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}`);
trevnorris
left a comment
There was a problem hiding this comment.
thanks for the changes
|
Uh oh, these work just fine on |
|
Hmmmm, that might be flakey. I can't repo it now. |
|
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: Probably race condition. The comment around before line 93 (where the test fails) kind of suggests that too: |
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