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 race conditions #55

Merged
merged 6 commits into from
Jul 11, 2019
Merged

Fix race conditions #55

merged 6 commits into from
Jul 11, 2019

Conversation

ausi
Copy link
Member

@ausi ausi commented Jul 11, 2019

Fixes #54

I found another race condition and fixed it in d6fd14b but I’m not sure if this works on all platforms.

@ausi ausi added the bug label Jul 11, 2019
@ausi ausi self-assigned this Jul 11, 2019
@ausi
Copy link
Member Author

ausi commented Jul 11, 2019

but I’m not sure if this works on all platforms.

It doesn’t work on windows: Failed to remove file "…": unlink(…): Resource temporarily unavailable..

I don’t know how to fix that.

@aschempp
Copy link
Member

@ausi
Copy link
Member Author

ausi commented Jul 11, 2019

No, that wouldn’t help. I would have to release the lock first before deleting the file and that would enable the race condition again.

@ausi
Copy link
Member Author

ausi commented Jul 11, 2019

A possible workaround might be to remove all file contents, release the lock and then unlink the file. When reading the file and it’s empty we could handle it the same way as if it didn’t exist at all.

@ausi
Copy link
Member Author

ausi commented Jul 11, 2019

As a workaround for windows we now retry to delete the file after releasing the lock if the first delete attemt fails (84f52c9)

@ausi ausi requested a review from Toflar July 11, 2019 14:26
Copy link
Member

@Toflar Toflar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ausi ausi merged commit 0743c54 into contao:master Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Race condition
3 participants