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

[5.8] Write manifest with exclusive lock #28910

Closed
wants to merge 2 commits into from
Closed

[5.8] Write manifest with exclusive lock #28910

wants to merge 2 commits into from

Conversation

rikwasmus
Copy link

On very busy sites, multiple processes could attempt to write to the file, causing race conditions in writing to it with invalid syntax. Lock the file exclusively to avoid parse errors.

On very busy sites, multiple processes could attempt to write to the
file, causing race conditions in writing to it with invalid syntax.
@GrahamCampbell GrahamCampbell changed the title Write manifest with exclusive lock [5.8] Write manifest with exclusive lock Jun 21, 2019
@GrahamCampbell
Copy link
Member

Please could you update the tests too.

@taylorotwell
Copy link
Member

About 99% sure this was already merged and then reverted once. Did you search the PR history.

@rikwasmus
Copy link
Author

I can only find #10663, seems unrelated. Would be curious as to what the failure scenario would be while adding the LOCK_EX, seems widely supported enough.

flock() allows you to perform a simple reader/writer model which can be used on virtually every platform (including most Unix derivatives and even Windows).

@rikwasmus
Copy link
Author

Last change around the line was 8c67e93f which isn't related either.

@taylorotwell
Copy link
Member

I don't think I have any plans to change this on a point release.

@rikwasmus
Copy link
Author

Hi,

  • I never asked this to be in a point release, I just followed this guide: https://laravel.com/docs/5.8/contributions#which-branch, which told me to MR against 5.8
  • is this only closed as a point release request, or just denied?
  • this seems more denied on the fact that there is another bug you hit in Illuminate\Filesystem\Filesystem::put() in that case. As it should be easily resolvable with an atomic rename for filesystems which encounter this, I could write a fix for that as well. I won't bother if you currently already know it will be denied though.
  • the original issue remains an issue in the current state for high traffic sites
  • of note may be that it makes php artisan cache:clear unusable, and incorrect cache needed to be manually deleted, as apparently the file in the cache is amazingly used to clear the cache (but that might be some developers quirk on our side...)

@rikwasmus
Copy link
Author

No answer, I'll withdraw my offer of fixing the filesystem bug, and we'll leave it for the next guy to encounter either the broken manifest file due to concurrent reads, or other issues with the exclusive lock writing.

If someone encounter this later: probably just do an atomic rename() in Illuminate\Filesystem\Filesystem::put() instead of an LOCK_EX if you got the energy.

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.

4 participants