Skip to content
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

"npm test" fails occasionally (potential race condition) #3759

Closed
4 tasks done
seaoak opened this issue Oct 12, 2019 · 0 comments
Closed
4 tasks done

"npm test" fails occasionally (potential race condition) #3759

seaoak opened this issue Oct 12, 2019 · 0 comments

Comments

@seaoak
Copy link
Member

seaoak commented Oct 12, 2019

Check List

Please check followings before submitting a new issue.

  • I have already read Docs page & Troubleshooting page
  • I have already searched existing issues and they are not help to me
  • I examined error or warning messages and it's difficult to solve
  • Node.js is higher than 6.9

Expected behavior

"npm test" always runs successfully.

Actual behavior

When "npm test" is repeated, it fails occasionally.
The failure is a test case "process() - hash changed" in test/scripts/box/box.js.

How to reproduce?

$ while npm test; do :; done

On my environments (VPS on cloud, my desktop Windows PC),
"npm test" fails within 2-10 times.

Environment & Settings

  • Node.js v12.11.1, v10.16.3, v8.16.2
  • HEAD of master branch / @6f6084cb4d5772061aa45703b258634a0db13cee
  • Ubuntu 16.04.6 LTS, Windows 10 Pro 64bit (revision 1903)

Details

When "npm test" runs multiple times, a test case in 'test/scripts/box/box.js` fails occasionally.
This is caused by a potential race condition.

The test case "process() - hash changed" fails
if it starts and finishes within wall-clock timer tick (=1ms).

This can be explained by the implementation of "box.Cache" (lib/models/cache.js).
"box.Cache" makes decision about "cache hit/miss" based on "mtime" and "hash" of target file.
"box.Cache" says "cache miss" only when both "mtime" and "hash" are changed.

The test case expects that "box.Cache" says "cache miss" always when "hash" is changed.
Unfortunately "box.Cache" says "cache hit" if "mtime" is not changed.

curbengh added a commit that referenced this issue Oct 12, 2019
…-condition

test: Fix up potential race condition in test cases of "box" (fix #3759)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant