-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Very Strange Cache Behaviour #27880
Comments
Also worth noting that the hash reported by Final comment for now - using |
We're also seeing this behaviour in more complex use cases too. e.g. When we're building our docs, we run Of course, we can safely exclude those files from the "inputs" because they only change if other files change. Still, it's very unexpected and not documented anywhere - and in fact the docs say "the contents of files", here: https://nx.dev/reference/inputs#source-files and here: https://nx.dev/reference/inputs#outputs-of-dependent-tasks |
"inputs": [
"production",
"^production",
"!{projectRoot}/docs/api-reference/**/*",
"!{projectRoot}/static/files/oas-schema.generated.json"
],
Scratch that, had a typo in my path in the nxigniore |
Hi Chris, you should never remove
Regarding the issue, I have identified the problem and will check how to solve it. Than you for reporting it. |
we would never commit it normally no, but we were interested to see what was changing between runs to see if it gave some clues. |
I've been seeing those |
possibly related: #23106 |
add |
Hi, this should be fixed in the v20. @ChrisSargent can you please verify? |
Fixed by #28024 |
Current Behavior
We have been having a lot of unusual issues with unexpected cache misses and after spending an inordinate amount of time trying to debug, we have found some very odd behaviour.
We have found that deleting and re-creating the same file in VSCode can result in a cache miss. This was a massive surprise to us since everything we had read points to Nx only using the file contents to create its hashes - and worth pointing out at this point that we were simply deleting the file and then discarding the change via git. Of course, this results in a 'new' file with a new created / modified date.....
But then, we tried simply deleting the file through Finder and then hitting
cmd+z
to undo the change, whereby created & modified dates do not get changed, we saw the exact same behaviour. Simply deleting the file brought a whole bunch of changes in the.nx/workspace-data/file-map.json
file. Running the same task results in a cache miss.Note that re-performing these steps does NOT result in a cache miss on the subsequent runs.... i.e. performing the delete / restore then doing a run, then doing the delete / restore / run again is cached as expected.
We have a pretty large repo with >100 projects so we wondered if it was something in our setup but we were able to recreate this in a brand new, tiny repo which is linked below.
Expected Behavior
Deleting / restoring files with the exact same content should not result in a cache mis.s
GitHub Repo
https://github.com/noah-labs/nx-cache-issue
Steps to Reproduce
Steps are provide in the github repro too:
Create an Nx Project
(In my case here, I also removed the .nx/workspace-data folder from the git ignore so I could trace changes)
Create a JS Lib
Run the tasks
yarn nx run-many -t lint
yarn nx run-many -t lint
again, result is cachedmylib/src/index.ts
and then hitcmd+z
to undo.nx/workspace-data/file-map.json
file changes significantlyyarn nx run-many -t lint
again, result is NOT cachedyarn nx reset
followed by the lint command will revert the changes that happened to the.nx/workspace-data/file-map.json
in step 5file-map.json
file nowNx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: