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

Fix startup failure if the cache directory points to a broken symlink #478

Merged
merged 1 commit into from Mar 5, 2024

Conversation

Earlopain
Copy link
Contributor

Discovered in Shopify/ruby-lsp-rails#278

If the cache directory is a symlink and points to another directory that doesn't exist, saving the cache will fall into an infinite loop. This is because of the retry logic at

rescue Errno::EEXIST
retry

This patch forces a different error by trying to resolve the symlink. Calling File.realpath on a broken symlink will raise Errno::ENOENT which will not be retried.

A setup explanation to even end up in this state is provided at Shopify/ruby-lsp-rails#278 (comment)

@mttkay can you check if this fixes the issue for you?

@mttkay
Copy link

mttkay commented Mar 5, 2024

I applied the patch locally and I can confirm this fixes the problem for me.

Thank you!

@casperisfine casperisfine merged commit 9210a2e into Shopify:main Mar 5, 2024
15 of 16 checks passed
@Earlopain Earlopain deleted the store-with-broken-symlink branch March 5, 2024 11:52
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

Successfully merging this pull request may close these issues.

None yet

3 participants