| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
test-stream2-readable-empty-buffer-no-eof fails on resource-constrained machines due to its use of timers. Removing timers makes it more reliable and doesn’t affect the validity of the test, as it only uses relative timing relations. Failures were noticed on freebsd10-64 in CI. I am able to replicate the failure with `tools/test.py --repeat=100 -j 100`. When run alone, it passes reliably.
|
Tiniest of nits: The comment near the top of the test refers to "set the timeouts to call r.read(0)". Might change it to something like "use setImmediate() to call r.read(0)"? |
Sorry, something went wrong.
| case 4: | ||
| setTimeout(r.read.bind(r, 0), timeout); | ||
| return setTimeout(function() { | ||
| setImmediate(setImmediate, r.read.bind(r, 0)); |
There was a problem hiding this comment.
Is the double setImmediate() here intentional?
Sorry, something went wrong.
There was a problem hiding this comment.
@Trott yes, it’s so that this one still gets executed after the one below (I think that appropriately maps the timeout-vs-no-timeout relation the timers had before?)
Sorry, something went wrong.
There was a problem hiding this comment.
They're guaranteed to execute in the order they are called so I don't think that inner setImmediate is needed.
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, but then the test fails. Hmmm... Not sure what's wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Oh, I misread your comment. Urp. Yeah, I wonder if the thing to do is just swap them like this:
const rv = setImmediate(function() {
return r.push(Buffer.alloc(0));
});
setImmediate(r.read.bind(r, 0));
return rv;Easier to read/understand and same effect?
Sorry, something went wrong.
There was a problem hiding this comment.
(Whoops, typo'ed in the code snippet, edited, above is what I meant.)
Sorry, something went wrong.
There was a problem hiding this comment.
@Trott Mh, I’ve switched to two single setImmediates with reverse order, that should be okay 👍
Sorry, something went wrong.
|
Another super tiny nit, totally ignore if it's just tedious and low value in your opinion: I think this test would be easier to understand if the cases were reversed, since 5 gets called first and 0 last. |
Sorry, something went wrong.
|
The assignment of common can be removed. (Linter is failing because of it--common doesn't get used.) |
Sorry, something went wrong.
No no, you’re right. I’ve reversed them. |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
All CI issues in that last run are infra-related. Running again: https://ci.nodejs.org/job/node-test-pull-request/4751/ |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Checklist
Affected core subsystem(s)
test stream
Description of change
This is a proposed alternative to #9359, and I’ve taken the liberty to basically use @Trott’s commit message from there:
test-stream2-readable-empty-buffer-no-eof fails on resource-constrained
machines due to its use of timers. Removing timers makes it more
reliable and doesn’t affect the validity of the test, as it only uses
relative timing relations.
Failures were noticed on freebsd10-64 in CI. I am able to replicate the
failure with tools/test.py --repeat=100 -j 100. When run alone, it
passes reliably.