Skip to content

Fix overly long mtime change delay calibration with HFS+. - #4231

Closed
23Skidoo wants to merge 1 commit into
haskell:masterfrom
23Skidoo:fix-hfs-mtime-resolution-calibration
Closed

23Skidoo wants to merge 1 commit into
haskell:masterfrom
23Skidoo:fix-hfs-mtime-resolution-calibration

Conversation

@23Skidoo

Copy link
Copy Markdown
Member

Fixes #4230.

@mention-bot

Copy link
Copy Markdown

@23Skidoo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ezyang, @phadej and @sol to be potential reviewers.

@ezyang

ezyang commented Jan 13, 2017

Copy link
Copy Markdown
Contributor

What's the testing plan for this? Can we mock file system time interface? What happens if the resolution is 0.999s?

@23Skidoo

Copy link
Copy Markdown
Member Author

What's the testing plan for this? Can we mock file system time interface?

I can do this, but seems more trouble than it's worth. Maybe just ask @gracjan to test on his system?

What happens if the resolution is 0.999s?

We can change the check to mtime0 >= 1000000 || (1000000 - mtime0) <= 10000.

@ezyang

ezyang commented Jan 13, 2017

Copy link
Copy Markdown
Contributor

Legacy code is code without an automated test suite ;) But, we do have Mac OS X CI setup, so we could just test to make sure the calibration time doesn't take a wacky amount of time.

Isn't that a more reasonable metric? We don't want to spend too much time calibrating, so use that as the stopping point?

@23Skidoo

Copy link
Copy Markdown
Member Author

But, we do have Mac OS X CI setup, so we could just test to make sure the calibration time doesn't take a wacky amount of time.

OK, will do.

@ezyang

ezyang commented Jan 13, 2017

Copy link
Copy Markdown
Contributor

BTW, this is well worth solving; I bet we are chewing up a decent amount of time in our Mac OS X CI recalibrating here!

@23Skidoo

Copy link
Copy Markdown
Member Author

Added a test.

@23Skidoo
23Skidoo force-pushed the fix-hfs-mtime-resolution-calibration branch from fc96286 to d62d7c1 Compare January 13, 2017 12:17
@23Skidoo

Copy link
Copy Markdown
Member Author

@ezyang You were quite right, apparently my fix doesn't actually work on OS X. Will try increasing the epsilon and/or following @gracjan's suggestions.

@23Skidoo
23Skidoo force-pushed the fix-hfs-mtime-resolution-calibration branch 3 times, most recently from ac7a079 to 05aaaa5 Compare January 16, 2017 13:33
@23Skidoo

Copy link
Copy Markdown
Member Author

Increasing the epsilon to 0.1 s seems to do the trick... will now try @gracjan's suggestion.

@ezyang

ezyang commented Jan 22, 2017

Copy link
Copy Markdown
Contributor

Still failing Travis on OS X, it's real.

@gracjan

gracjan commented Jan 23, 2017

Copy link
Copy Markdown

The list of mtimes measured in the function looks like this:

*Distribution.Backpack Distribution.Compat.Time> calibrateMtimeChangeDelay 
[335264,994224,999491,1000088,999906,1000045,999953,1000012,999869,1001424,1003468,995152,999844,1000068,999953,1000066,1000889,998953,1003979,996114,1238135,761660,1000062,1006898,993069]
(1238135,1000000)

With bail-out after first measurement that gives 1s or more the list will be [335264, 994224, 999491, 1000088] and that is 3329067 (3.3s).

I'd like to make clear that '@gracjan's suggestion' is to measure file system resolution not clock resolution and that should take on average 0.5s on 1s resolution filesystem.

@23Skidoo 23Skidoo added this to the 2.0 milestone Feb 17, 2017
@23Skidoo
23Skidoo force-pushed the fix-hfs-mtime-resolution-calibration branch from 05aaaa5 to 9752f24 Compare May 5, 2017 08:27
@23Skidoo 23Skidoo modified the milestones: 2.0.1, 2.0 May 5, 2017
@23Skidoo

23Skidoo commented May 5, 2017

Copy link
Copy Markdown
Member Author

Remilestoned.

@23Skidoo 23Skidoo modified the milestones: 2.0.1, 2.0.2 Sep 19, 2017
@23Skidoo 23Skidoo modified the milestones: 2.0.2, 2.4 Aug 29, 2018
@23Skidoo 23Skidoo modified the milestones: 2.4, 2.4.1 Sep 17, 2018
@23Skidoo 23Skidoo modified the milestones: 2.4.1.0, 2.4.2.0 Apr 26, 2019
@phadej phadej modified the milestones: 2.4.2.0, 3.4 Nov 27, 2019
@mergify mergify Bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Sep 1, 2022
@ulysses4ever ulysses4ever removed the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Sep 3, 2022
@Kleidukos

Copy link
Copy Markdown
Member

Marking this PR as draft 🙂

@Kleidukos
Kleidukos marked this pull request as draft May 17, 2023 06:32
@ffaf1

ffaf1 commented May 8, 2025

Copy link
Copy Markdown
Collaborator

Hello, I am going through old PRs to check whether they are stale.

If this PR is still “live”, write a comment and I will remove the consider closing label. Otherwise in ≃ 2 weeks this PR will be closed.

@ffaf1 ffaf1 closed this Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calibrateMtimeChangeDelay takes 25s to execute on Mac OS X with HFS+ system

8 participants