-
Notifications
You must be signed in to change notification settings - Fork 30k
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
test: investigate flaky - parallel/test-readline-interface #14674
Comments
If somebody has the time, it might be helpful to insert a couple debug statements to check the order in which events happen and then kick of a stress test until this reproduces. Or maybe just increasing the timeouts/using |
I support use |
This is already at the top of my short list of things to deal with. daf5596 was a precursor for making it more modular. Definitely flaky |
It's flaky even if I eliminate all the timers etc. and just have a test that looks like this: 'use strict';
const common = require('../common');
const assert = require('assert');
const readline = require('readline');
const internalReadline = require('internal/readline');
const EventEmitter = require('events').EventEmitter;
const inherits = require('util').inherits;
const { Writable, Readable } = require('stream');
function FakeInput() {
EventEmitter.call(this);
}
inherits(FakeInput, EventEmitter);
FakeInput.prototype.resume = () => {};
FakeInput.prototype.pause = () => {};
FakeInput.prototype.write = () => {};
FakeInput.prototype.end = () => {};
[false].forEach(function(terminal) {
{
const fi = new FakeInput();
const rli = new readline.Interface(
{ input: fi, output: fi, terminal: terminal }
);
const expectedLines = ['foo', 'bar', 'baz', 'bat'];
let callCount = 0;
rli.on('line', function(line) {
assert.strictEqual(line, expectedLines[callCount]);
callCount++;
});
expectedLines.forEach(function(line) {
fi.emit('data', `${line}\r`);
fi.emit('data', '\n');
});
assert.strictEqual(callCount, expectedLines.length);
rli.close();
}
}); Running it with this: tools/test.py -j 96 --repeat 96 test/parallel/test-readline-interface.js … still shows failures like this: AssertionError [ERR_ASSERTION]: '' === 'bar' This means that The question is: Is this a feature (under resource constraints, stuff starts getting dropped) or is it actually a bug in |
@nodejs/streams maybe? |
@Trott I don’t think data is getting dropped, it’s that the delay between processing I do think it’s problematic that this happens even for synchronously emitted input. Maybe we should be using |
😮 Thank you. That makes way more sense. |
@addaleax Brilliant. That doesn't solve all the test's problems, but it solves most of them (and the primary remaining issue looks like it was solved by @Azard in another PR so we're really close...). |
@Trott Did you try that out? If it works, great 👍 Feel free to do a PR yourself if you have the time :) |
Previous unit test delay is too short for parallel test on raspberry pi, it will fail sometimes. This PR use common.platformTimeout and widen the time gap. PR-URL: nodejs#14677 Ref: nodejs#14674 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Using Date.now() introduces problems when operating under load or otherwise with constrained resources. Use Timer.now() to mitigate. The problem was identified in `test-readline-interface` where under heavy load, `\r` and `\n` were received so far apart that they were treated as separate line endings rather than a single line ending. Switching to `Timer.now()` prevented this from happening. Refs: nodejs#14674
Two test cases in `test-readline-interface` are sensitive to resource constraints (probably due to `\r` and `\n` not arriving within the appropriate delay to be treated as a single line ending). Move those tests to `sequential`. Fixes: nodejs#14674
Using Date.now() introduces problems when operating under load or otherwise with constrained resources. Use Timer.now() to mitigate. The problem was identified in `test-readline-interface` where under heavy load, `\r` and `\n` were received so far apart that they were treated as separate line endings rather than a single line ending. Switching to `Timer.now()` prevented this from happening. PR-URL: nodejs#14681 Refs: nodejs#14674 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Previous unit test delay is too short for parallel test on raspberry pi, it will fail sometimes. This PR use common.platformTimeout and widen the time gap. PR-URL: #14677 Ref: #14674 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Using Date.now() introduces problems when operating under load or otherwise with constrained resources. Use Timer.now() to mitigate. The problem was identified in `test-readline-interface` where under heavy load, `\r` and `\n` were received so far apart that they were treated as separate line endings rather than a single line ending. Switching to `Timer.now()` prevented this from happening. PR-URL: #14681 Refs: #14674 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Two test cases in `test-readline-interface` are sensitive to resource constraints (probably due to `\r` and `\n` not arriving within the appropriate delay to be treated as a single line ending). Move those tests to `sequential`. PR-URL: #14681 Fixes: #14674 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Previous unit test delay is too short for parallel test on raspberry pi, it will fail sometimes. This PR use common.platformTimeout and widen the time gap. PR-URL: #14677 Ref: #14674 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
The readline module wants a truthy time while using Timer.now() doesn't necessarily guarantee that early on in the process' life. It also doesn't actually resolve the timing issues experienced in an earlier issue. Instead, this PR fixes the related tests and moves them back to parallel. Refs: nodejs#14674
The readline module wants a truthy time while using Timer.now() doesn't necessarily guarantee that early on in the process' life. It also doesn't actually resolve the timing issues experienced in an earlier issue. Instead, this PR fixes the related tests and moves them back to parallel. Refs: nodejs#14674 PR-URL: nodejs#18563 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
The readline module wants a truthy time while using Timer.now() doesn't necessarily guarantee that early on in the process' life. It also doesn't actually resolve the timing issues experienced in an earlier issue. Instead, this PR fixes the related tests and moves them back to parallel. Refs: #14674 PR-URL: #18563 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
The readline module wants a truthy time while using Timer.now() doesn't necessarily guarantee that early on in the process' life. It also doesn't actually resolve the timing issues experienced in an earlier issue. Instead, this PR fixes the related tests and moves them back to parallel. Refs: #14674 PR-URL: #18563 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
The readline module wants a truthy time while using Timer.now() doesn't necessarily guarantee that early on in the process' life. It also doesn't actually resolve the timing issues experienced in an earlier issue. Instead, this PR fixes the related tests and moves them back to parallel. Refs: #14674 PR-URL: #18563 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
The readline module wants a truthy time while using Timer.now() doesn't necessarily guarantee that early on in the process' life. It also doesn't actually resolve the timing issues experienced in an earlier issue. Instead, this PR fixes the related tests and moves them back to parallel. Refs: #14674 PR-URL: #18563 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
The readline module wants a truthy time while using Timer.now() doesn't necessarily guarantee that early on in the process' life. It also doesn't actually resolve the timing issues experienced in an earlier issue. Instead, this PR fixes the related tests and moves them back to parallel. Refs: nodejs#14674 PR-URL: nodejs#18563 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
master
pi1-raspbian-wheezy
Refs: #13497
https://ci.nodejs.org/job/node-test-binary-arm/9466/RUN_SUBSET=5,label=pi1-raspbian-wheezy/
/cc @nodejs/platform-arm @addaleax @jasnell @Azard @princejwesley
The text was updated successfully, but these errors were encountered: