-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Do query the fsmonitor again after the index has been discarded #2127
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for debugging and fixing this. The new regression test and bug fix both look good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't debugged into it but the fact that the fsmonitor test failed in the test run indicated something isn't right.
Indeed, it is not even a flaky test, I re-ran it twice, and it still produced the same issue. Locally, no problem though! So I guess I will (ab-)use this PR to bisect. |
So, I re-ran it with Then I finally broke down and triggered yet another re-run, and it "fixed" it. So it is a flaky test, after all, and seems to be pretty hard to trigger. Which makes it likely to be some racy timestamp issue: since the However, the fact that the fsmonitor feature did not yield a false positive here makes me less worried. We still should have a closer look at this at some stage, but it is not like the fsmonitor incorrectly prevented a correct status update. That would be more critical. |
We took this to the Git mailing list and decided that there are no more concerns.
This one is tricky. When `core.fsmonitor` is set, a `refresh_index()` will not perform a full scan of files that might be modified, but will query the fsmonitor and refresh only the ones that have been actually touched. Due to implementation details, the fsmonitor is queried in `refresh_cache_ent()`, but of course it only has to be queried once, so we set a flag when we did that. But when the index was discarded, we did not re-set that flag. So far, this is only covered by our test suite when running with GIT_TEST_FSMONITOR=$PWD/t7519/fsmonitor-all, and only due to the way the built-in stash interacts with the recursive merge machinery. Let's introduce a straight-forward regression test for this. We simply extend the "read & discard index" loop in `test-tool read-cache` to optionally refresh the index, report on a given file's status, and then modify that file. Due to the bug described above, only the first refresh will actually query the fsmonitor; subsequent loop iterations will not. This problem was reported by Ævar Arnfjörð Bjarmason. Signed-off-by: Johannes Schindelin <[email protected]>
With this change, the `index_state` struct becomes the new home for the flag that says whether the fsmonitor hook has been run, i.e. it is now per-index. It also gets re-set when the index is discarded, fixing the bug demonstrated by the "test_expect_failure" test added in the preceding commit. In that case fsmonitor-enabled Git would miss updates under certain circumstances, see that preceding commit for details. Signed-off-by: Johannes Schindelin <[email protected]>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
Do query the fsmonitor again after the index has been discarded
This PR is in response to https://public-inbox.org/git/[email protected]/T/#mb8718fe52e4721dacd3b143a09187ff9090ef4e3