Uh oh!
There was an error while loading. Please reload this page.
fix: incorrect timers-promisified test case - #37425
Conversation
Trott
commented
Feb 18, 2021
@benjamingr@Linkgoron @nodejs/timers |
Trott
commented
Feb 18, 2021
Refs: #37395 |
Linkgoron
commented
Feb 18, 2021
In retrospect, I'm not 100% sure that the test is really necessary, as there are already some timing tests. However, while the test fix looks fine, I'm not sure what the policy is about test performance though, is ~400ms for a test OK? |
After looking at other test cases, I found this constTIMEOUT=common.platformTimeout(100)The definition of the function functionplatformTimeout(ms){constmultipliers=typeofms==='bigint' ?
{two: 2n,four: 4n,seven: 7n} : {two: 2,four: 4,seven: 7};if(process.features.debug)ms=multipliers.two*ms;if(isAIX)returnmultipliers.two*ms;// Default localhost speed is slower on AIXif(process.arch!=='arm')returnms;constarmv=process.config.variables.arm_version;if(armv==='6')returnmultipliers.seven*ms;// ARMv6if(armv==='7')returnmultipliers.two*ms;// ARMv7returnms;// ARMv8+}400ms is a long time, I admit. So maybe I can adjust it to |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95
commented
Feb 18, 2021
LinuxOne CI is passing: https://ci.nodejs.org/job/node-test-commit-linuxone/nodes=rhel7-s390x/25734/
That's sounds like a solid plan! Can you make this change? |
ttzztztz
commented
Feb 19, 2021
Implemented 51921f73890790322f58c1b263265c39d10c9c01, waiting for the test result. |
ttzztztz
commented
Feb 19, 2021
@aduh95 can you run the |
nodejs-github-bot
commented
Feb 19, 2021
aduh95
commented
Feb 19, 2021
Fast-track? |
| })); | ||
| setPromiseTimeout(3).then(() => post = true); | ||
| const time_unit = common.platformTimeout(50); |
There was a problem hiding this comment.
Optional nit: Since the problem we've been seeing is with the test being flaky on a fast machine, I wonder if common.platformTimeout() isn't needed here. It's usually for giving slow machines more time, but the problem we're seeing right now is the other way around--our LinuxONE host is too efficient.
Trott
commented
Feb 20, 2021
@nodejs/timers |
nodejs-github-bot
commented
Feb 21, 2021
PR-URL: nodejs#37425Fixes: nodejs#37395 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
targos
commented
Feb 25, 2021
Landed in 63794b4 |
This test case is incorrect, and it caused too many unit-test failures
https://ci.nodejs.org/job/node-test-commit-linuxone/nodes=rhel7-s390x/25697/testReport/
https://ci.nodejs.org/job/node-test-commit-linuxone/nodes=rhel7-s390x/25708/testReport/
...
You can see it in this page: https://ci.nodejs.org/job/node-test-commit-linuxone/nodes=rhel7-s390x/
This is probably caused by a wrong time-sequence execution order. I'm trying to work on this.
Analysis
Assume we execute this code at time 0
Time=0, FinishExecute=L1, callback L1 is queued to execute at Time=1
Time=1, FinishExecute=L2, callback L2 is queued to execute at Time=3, 5, 7, ...
Time=2, FinishExecute=L3
Time=11, FinishExecute=L4, callback L3 is queued to execute at Time=14
In this case, this unit test will throw an error
'second interval ran too early', but it is OK.My solution
First, the timeout is 10, 20, 30 to tolerate the time for code-execution
Second, use the
Promise.allto wait for these three promisesI think it would work.
Fixes: #37395