GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Test /parallel/test-fs-stat-bigint fails 3 out of 100 times · Issue #24593 · nodejs/node

Test /parallel/test-fs-stat-bigint fails 3 out of 100 times #24593

New issue
Copy link
New issue
Copy link
Closed
Closed
Test /parallel/test-fs-stat-bigint fails 3 out of 100 times#24593
Copy link
Assignees
refack
Labels
flaky-testIssues and PRs involving tests that fail intermittently in CI.fsIssues and PRs related to file-system APIs and the fs module.macosIssues and PRs related to the macOS platform.

Description

@dominikeinkemmer
dominikeinkemmer
opened on Nov 24, 2018
Issue body actions

Hey, I just ran the test suit and it seems that the tests for /parallel/test-fs-stat-bigint.js fail about 3 times in 100 runs. When running python2 tools/test.py --repeat=100 -J parallel/test-fs-stat-bigint the output is as follows:

=== release test-fs-stat-bigint ===                    
Path: parallel/test-fs-stat-bigint
(node:56622) ExperimentalWarning: The fs.promises API is experimental
assert.js:351
    throw err;
    ^

AssertionError [ERR_ASSERTION]: atimeMs is not a safe integer, difference should < 1.
Number version 1543043785204.1536, BigInt version 1543043785197n
    at verifyStats (/Users/dominik.einkemmer/Documents/Nodefest/node/test/parallel/test-fs-stat-bigint.js:72:7)
    at fs.stat (/Users/dominik.einkemmer/Documents/Nodefest/node/test/parallel/test-fs-stat-bigint.js:109:7)
    at FSReqCallback.oncomplete (fs.js:162:5)
Command: out/Release/node /Users/dominik.einkemmer/Documents/Nodefest/node/test/parallel/test-fs-stat-bigint.js
=== release test-fs-stat-bigint ===                    
Path: parallel/test-fs-stat-bigint
(node:56623) ExperimentalWarning: The fs.promises API is experimental
assert.js:351
    throw err;
    ^

AssertionError [ERR_ASSERTION]: atimeMs is not a safe integer, difference should < 1.
Number version 1543043785206.173, BigInt version 1543043785199n
    at verifyStats (/Users/dominik.einkemmer/Documents/Nodefest/node/test/parallel/test-fs-stat-bigint.js:72:7)
    at fs.stat (/Users/dominik.einkemmer/Documents/Nodefest/node/test/parallel/test-fs-stat-bigint.js:109:7)
    at FSReqCallback.oncomplete (fs.js:162:5)
Command: out/Release/node /Users/dominik.einkemmer/Documents/Nodefest/node/test/parallel/test-fs-stat-bigint.js
=== release test-fs-stat-bigint ===                    
Path: parallel/test-fs-stat-bigint
assert.js:351
    throw err;
    ^

AssertionError [ERR_ASSERTION]: atimeMs is not a safe integer, difference should < 1.
Number version 1543043785397.4092, BigInt version 1543043785396n
    at verifyStats (/Users/dominik.einkemmer/Documents/Nodefest/node/test/parallel/test-fs-stat-bigint.js:72:7)
    at Object.<anonymous> (/Users/dominik.einkemmer/Documents/Nodefest/node/test/parallel/test-fs-stat-bigint.js:84:3)
    at Module._compile (internal/modules/cjs/loader.js:722:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:775:12)
    at startup (internal/bootstrap/node.js:300:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:826:3)
Command: out/Release/node /Users/dominik.einkemmer/Documents/Nodefest/node/test/parallel/test-fs-stat-bigint.js
[00:02|% 100|+  97|-   3]: Done

My system spec:

  • Macbook: MacBook Pro (13-inch, 2018)
  • Operating system: MacOS Mojave v10.14.1
  • Processor: 2.7 GHz Intel Core i7
  • Memory: 16 GB 2133 MHz LPDDR3

Activity

Next
  1. addaleax
    added
    flaky-testIssues and PRs involving tests that fail intermittently in CI.
    fsIssues and PRs related to file-system APIs and the fs module.
    on Nov 24, 2018
  2. Trott commented on Nov 24, 2018

    @Trott
    Trott
    on Nov 24, 2018
    Member
    More actions

    See also: #24565

  3. Trott commented on Nov 24, 2018

    @Trott
    Trott
    on Nov 24, 2018
    Member
    More actions

    /ping @joyeecheung

  4. refack commented on Nov 25, 2018

    @refack
    refack
    on Nov 25, 2018
    Contributor
    More actions

    Possible fix/clarify - #23821

  5. refack
    added
    macosIssues and PRs related to the macOS platform.
    on Nov 25, 2018
  6. bnoordhuis commented on Nov 27, 2018

    @bnoordhuis
    bnoordhuis
    on Nov 27, 2018
    Member
    More actions

    I haven't been able to reproduce but looking at the test and the output OP posted, I suspect there's something updating the atime between the two stat calls. The tests in test-fs-stat-bigint.js follow this pattern:

    1. stat/fstat/lstat either synchronously or asynchronously with { bigint: true }, then
    2. repeat the operation but this time without { bigint: true }

    There's a time window between 1 and 2 where an external actor can update the atime. The three failures all have bigint atime < non-bigint atime, probably not a coincidence.

  7. bnoordhuis commented on Nov 29, 2018

    @bnoordhuis
    bnoordhuis
    on Nov 29, 2018
    Member
    More actions

    Failure on smartos:

    13:01:01 not ok 649 parallel/test-fs-stat-bigint
    13:01:01   ---
    13:01:01   duration_ms: 0.727
    13:01:01   severity: fail
    13:01:01   exitcode: 1
    13:01:01   stack: |-
    13:01:01     assert.js:86
    13:01:01       throw new AssertionError(obj);
    13:01:01       ^
    13:01:01     
    13:01:01     AssertionError [ERR_ASSERTION]: 1543428061215n !== 1543428061216n
    13:01:01     key=atimeMs, val=1543428061216
    13:01:01         at verifyStats (/home/iojs/build/workspace/node-test-commit-smartos/nodes/smartos16-64/test/parallel/test-fs-stat-bigint.js:66:14)
    13:01:01         at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-smartos/nodes/smartos16-64/test/parallel/test-fs-stat-bigint.js:101:3)
    13:01:01         at Module._compile (internal/modules/cjs/loader.js:722:30)
    13:01:01         at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    13:01:01         at Module.load (internal/modules/cjs/loader.js:620:32)
    13:01:01         at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    13:01:01         at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    13:01:01         at Function.Module.runMain (internal/modules/cjs/loader.js:775:12)
    13:01:01         at startup (internal/bootstrap/node.js:300:19)
    13:01:01         at bootstrapNodeJSCore (internal/bootstrap/node.js:826:3)
    
  8. joyeecheung commented on Nov 29, 2018

    @joyeecheung
    joyeecheung
    on Nov 29, 2018
    Member
    More actions

    Considering some of the tests there are synchronous and some of them are asynchronous, and it fails with python2 tools/test.py --repeat=100 -J parallel/test-fs-stat-bigint, and that the stat calls share one global AliasedBuffer to transport data from C++, it may help to either split this test, or use different AliasedBuffers in the implementation (it's not yet clear to me wether sharing the buffer in callback/synchronous APIs would actually introduce a bug, theoretically it shouldn't)

  9. bnoordhuis commented on Dec 3, 2018

    @bnoordhuis
    bnoordhuis
    on Dec 3, 2018
    Member
    More actions

    I don't think that's it. There's no sharing taking place, the typed array is passed from C++ to JS and immediately converted to a Stats object.

    FWIW, I can reproduce when I run while true; do cat test/.tmp*/* > /dev/null; done in another terminal (but check with mount that the fs isn't mounted with noatime.)

  10. Trott commented on Dec 31, 2018

    @Trott
    Trott
    on Dec 31, 2018
    Member
    More actions

    Another failure on SmartOS, seems off-by-one as in @bnoordhuis's example posted above. Is that a bug in the result or should the test actually permit off-by-one in the timestamp? (Seems like a bug but maybe there's a subtlety I'm missing. I haven't looked closely at all.)

    https://ci.nodejs.org/job/node-test-commit-smartos/22861/nodes=smartos16-64/console

    test-joyent-smartos16-x64-1

    00:12:30 not ok 691 parallel/test-fs-stat-bigint
    00:12:30   ---
    00:12:30   duration_ms: 0.535
    00:12:30   severity: fail
    00:12:30   exitcode: 1
    00:12:30   stack: |-
    00:12:30     (node:636936) ExperimentalWarning: The fs.promises API is experimental
    00:12:30     assert.js:86
    00:12:30       throw new AssertionError(obj);
    00:12:30       ^
    00:12:30     
    00:12:30     AssertionError [ERR_ASSERTION]: 1546243950493n !== 1546243950494n
    00:12:30     key=atimeMs, val=1546243950494
    00:12:30         at verifyStats (/home/iojs/build/workspace/node-test-commit-smartos/nodes/smartos16-64/test/parallel/test-fs-stat-bigint.js:66:14)
    00:12:30         at fs.stat (/home/iojs/build/workspace/node-test-commit-smartos/nodes/smartos16-64/test/parallel/test-fs-stat-bigint.js:109:7)
    00:12:30         at FSReqCallback.oncomplete (fs.js:160:5)
    00:12:30   ...

    @nodejs/platform-smartos @nodejs/fs

  11. Trott commented on Jan 15, 2019

    @Trott
    Trott
    on Jan 15, 2019
    Member
    More actions

    Failure on debian9-64:

    https://ci.nodejs.org/job/node-test-commit-linux/24665/nodes=debian9-64/console

    test-softlayer-debian9-x64-1

    00:05:02 not ok 593 parallel/test-fs-stat-bigint
    00:05:02   ---
    00:05:02   duration_ms: 0.141
    00:05:02   severity: fail
    00:05:02   exitcode: 1
    00:05:02   stack: |-
    00:05:02     assert.js:86
    00:05:02       throw new AssertionError(obj);
    00:05:02       ^
    00:05:02     
    00:05:02     AssertionError [ERR_ASSERTION]: 1547539502126n !== 1547539502127n
    00:05:02     key=atimeMs, val=1547539502127
    00:05:02         at verifyStats (/home/iojs/build/workspace/node-test-commit-linux/nodes/debian9-64/test/parallel/test-fs-stat-bigint.js:66:14)
    00:05:02         at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-linux/nodes/debian9-64/test/parallel/test-fs-stat-bigint.js:93:3)
    00:05:02         at Module._compile (internal/modules/cjs/loader.js:722:30)
    00:05:02         at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    00:05:02         at Module.load (internal/modules/cjs/loader.js:621:32)
    00:05:02         at tryModuleLoad (internal/modules/cjs/loader.js:564:12)
    00:05:02         at Function.Module._load (internal/modules/cjs/loader.js:556:3)
    00:05:02         at Function.Module.runMain (internal/modules/cjs/loader.js:775:12)
    00:05:02         at executeUserCode (internal/bootstrap/node.js:433:15)
    00:05:02         at startExecution (internal/bootstrap/node.js:370:3)
    00:05:02   ...
  12. refack commented on Jan 30, 2019

    @refack
    refack
    on Jan 30, 2019
    Contributor
    More actions

    OS - Windows
    Worker - https://ci.nodejs.org/computer/test-azure_msft-win2016-x64-2/
    Link - https://ci.nodejs.org/job/node-test-binary-windows/23418/COMPILED_BY=vs2017,RUNNER=win2016,RUN_SUBSET=1/

    AssertionError [ERR_ASSERTION]: 1548817600661n !== 1548817600662n
    key=atimeMs, val=1548817600662
        at verifyStats (c:\workspace\node-test-binary-windows\test\parallel\test-fs-stat-bigint.js:66:14)
        at c:\workspace\node-test-binary-windows\test\parallel\test-fs-stat-bigint.js:140:3
    

    This is the test code:

    node/test/parallel/test-fs-stat-bigint.js

    Lines 136 to 141 in 5e1d446

    (async function() {
    const filename = getFilename();
    const bigintStats = await promiseFs.stat(filename, { bigint: true });
    const numStats = await promiseFs.stat(filename);
    verifyStats(bigintStats, numStats);
    })();

    ...

    node/test/parallel/test-fs-stat-bigint.js

    Line 22 in 5e1d446

    function verifyStats(bigintStats, numStats) {

    ...

    node/test/parallel/test-fs-stat-bigint.js

    Lines 65 to 70 in 5e1d446

    } else if (Number.isSafeInteger(val)) {
    assert.strictEqual(
    bigintStats[key], BigInt(val),
    `${inspect(bigintStats[key])} !== ${inspect(BigInt(val))}\n` +
    `key=${key}, val=${val}`
    );

    So bigintStats is calculated first, before numStats

    Is the "atime is changed between the calls" hypothesis is correct, flipping L138 and L139 should flip the sides on the inequality. I'm testing that now.

  13. refack commented on Jan 30, 2019

    @refack
    refack
    on Jan 30, 2019
    Contributor
    More actions
    AssertionError [ERR_ASSERTION]: 1548858177822n !== 1548858177823n
    key=atimeMs, val=1548858177823
        at verifyStats (D:\code\node\test\parallel\test-fs-stat-bigint.js:66:14)
        at D:\code\node\test\parallel\test-fs-stat-bigint.js:140:3
    Command: D:\code\node\Release\node.exe D:\code\node\test\parallel\test-fs-stat-bigint.js
    [00:21|% 100|+  99|-   1]: Done

    numStats is still > bigintStats, even when numStats is calculated first, so this might indicate numerical instability.

  14. joyeecheung commented on Jan 30, 2019

    @joyeecheung
    joyeecheung
    on Jan 30, 2019
    Member
    More actions

    @refack That implies the bug lies somewhere in the numeric conversions?

    Reacted by Refael Ackermann
  15. 10 remaining items

  16. Trott
    added a commit that references this issue on Jun 12, 2019

    test: mark test-fs-stat-bigint as flaky

    d560d40
  17. Trott commented on Jun 14, 2019

    @Trott
    Trott
    on Jun 14, 2019
    Member
    More actions

    I am wondering whether #21387 may help - this moves the timespec-to-ms calculation into JS land entirely. It may make a difference for the precision loss.

    Stress test against master: https://ci.nodejs.org/job/node-stress-single-test/2225/

    Stress test against #21387: https://ci.nodejs.org/job/node-stress-single-test/2226/

    Might have to do this a few times to figure out how to trigger it in a stress test, but maybe not.

  18. BridgeAR
    added a commit that references this issue on Jun 17, 2019

    test: mark test-fs-stat-bigint as flaky

    31ccd36
  19. Trott commented on Feb 7, 2020

    @Trott
    Trott
    on Feb 7, 2020
    Member
    More actions

    This test doesn't seem to be failing anymore. (I used ncu-ci walk to look for failures in CI and also ran the test a few thousand times locally with no failures.) I'm going to close this, but feel free to re-open if this is observed again and/or if a reliable reproduction is found.

  20. Trott
    closed this as completedon Feb 7, 2020
  21. Trott commented on Feb 8, 2020

    @Trott
    Trott
    on Feb 8, 2020
    Member
    More actions

    Stress test on FreeBSD shows this is still A Thing.

  22. Trott
    reopened this on Feb 8, 2020
  23. Trott commented on Feb 8, 2020

    @Trott
    Trott
    on Feb 8, 2020
    Member
    More actions

    One failure out of 1000 runs.

    https://ci.nodejs.org/view/Stress/job/node-stress-single-test/nodes=freebsd11-x64/41/console

    13:41:12 not ok 1 parallel/test-fs-stat-bigint
    13:41:12   ---
    13:41:12   duration_ms: 0.187
    13:41:12   severity: fail
    13:41:12   exitcode: 1
    13:41:12   stack: |-
    13:41:12     assert.js:102
    13:41:12       throw new AssertionError(obj);
    13:41:12       ^
    13:41:12     
    13:41:12     AssertionError [ERR_ASSERTION]: 1n !== 9n
    13:41:12     key=blocks, val=9
    13:41:12         at verifyStats (/usr/home/iojs/build/workspace/node-stress-single-test/nodes/freebsd11-x64/test/parallel/test-fs-stat-bigint.js:83:14)
    13:41:12         at /usr/home/iojs/build/workspace/node-stress-single-test/nodes/freebsd11-x64/test/parallel/test-fs-stat-bigint.js:126:7
    13:41:12         at FSReqCallback.oncomplete (fs.js:175:5) {
    13:41:12       generatedMessage: false,
    13:41:12       code: 'ERR_ASSERTION',
    13:41:12       actual: 1n,
    13:41:12       expected: 9n,
    13:41:12       operator: 'strictEqual'
    13:41:12     }
    13:41:12   ...
    
  24. Trott
    added 2 commits that reference this issue on Feb 9, 2020

    test: fix flaky test-fs-stat-bigint

    74d8578

    test: fix flaky test-fs-stat-bigint

    acfb78b
  25. Trott
    closed this as completedin acfb78bon Feb 11, 2020
  26. codebytere
    added a commit that references this issue on Feb 17, 2020

    test: fix flaky test-fs-stat-bigint

    d36ba2b
  27. codebytere
    added 2 commits that reference this issue on Mar 15, 2020

    test: fix flaky test-fs-stat-bigint

    74686bf

    test: fix flaky test-fs-stat-bigint

    c9a6c78
  28. codebytere
    added a commit that references this issue on Mar 30, 2020

    test: fix flaky test-fs-stat-bigint

    7d71465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @refack
    refack

Labels

flaky-testIssues and PRs involving tests that fail intermittently in CI.fsIssues and PRs related to file-system APIs and the fs module.macosIssues and PRs related to the macOS platform.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.