Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpFoundation] use atomic writes in MockFileSessionStorage#39816
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
jderusse left a comment
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.
We should also handle concurency in read method:is_file($filePath) ? file_get_contents($filePath) given the file could be deleted in the meantime (see#39167 (comment))
nicolas-grekas commentedJan 13, 2021
Unless we have reports that this happens IRL, I think we should fix as little as possible. The linked report is only about non-atomic writes. I'd wait before doing more on this topic. |
jderusse commentedJan 13, 2021
I felt like the linked comment reported by@mpdude were a real case. |
nicolas-grekas commentedJan 13, 2021
It is, and the message there is about "Notice: unserialize()". That's unrelated to the |
mpdude commentedJan 13, 2021
Overhere, I also mentioned that the |
nicolas-grekas commentedJan 13, 2021
OK, thanks for the link. So you have processes that concurrently destroy the session? |
0d7d19c to7331030Comparenicolas-grekas commentedJan 13, 2021
Now updated to guard against concurrent |
mpdude commentedJan 13, 2021
Regarding@jderusse's comment above, the set_error_handler(staticfunction () {});try {$this->data = [];$this->data =unserialize(file_get_contents($filePath)); }finally {restore_error_handler(); } But regardless of that, 👍 and thanks for the fix! |
7331030 to5290e97Comparenicolas-grekas commentedJan 13, 2021
code updated |
solverat commentedJan 13, 2021
@nicolas-grekas i just merged your PR into my largest test-set, and it's still passing! Thank you! |
Instead of#39808