Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#39167
LicenseMIT
Doc PR-

Instead of#39808

@nicolas-grekasnicolas-grekas added this to the4.4 milestoneJan 13, 2021
@nicolas-grekasnicolas-grekas changed the titleRename normalize param[HttpFoundation] use atomic writes in MockFileSessionStorageJan 13, 2021
Copy link
Member

@jderussejderusse left a 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
Copy link
MemberAuthor

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
Copy link
Member

Unless we have reports that this happens IRL,

I felt like the linked comment reported by@mpdude were a real case.

@nicolas-grekas
Copy link
MemberAuthor

I felt like the linked comment reported by@mpdude were a real case.

It is, and the message there is about "Notice: unserialize()". That's unrelated to theis_file() check you're mentioning for now.

@mpdude
Copy link
Contributor

Overhere, I also mentioned that theunlink() call may be a source of errors as well, since the file might have been deleted by another process in the meantime.

@nicolas-grekas
Copy link
MemberAuthor

OK, thanks for the link. So you have processes that concurrently destroy the session?
That cannot work of course, whatever we do here, there will always be an issue with concurrent requests that read and destroy at the same time.
You should not destroy concurrently to me.

@nicolas-grekas
Copy link
MemberAuthor

Now updated to guard against concurrentunlink().

@mpdude
Copy link
Contributor

Regarding@jderusse's comment above, theis_file($filePath) ? file_get_contents($filePath) concurrency thing could also be addressed with something like

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!

@nicolas-grekas
Copy link
MemberAuthor

the is_file($filePath) ? file_get_contents($filePath) concurrency thing

code updated

mpdude reacted with heart emoji

@solverat
Copy link

@nicolas-grekas i just merged your PR into my largest test-set, and it's still passing! Thank you!

nicolas-grekas and OskarStark reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas merged commit9c6381c intosymfony:4.4Jan 14, 2021
@nicolas-grekasnicolas-grekas deleted the mock-sess-atomic branchJanuary 20, 2021 19:45
This was referencedJan 27, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jderussejderussejderusse approved these changes

+1 more reviewer

@solveratsolveratsolverat approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

5 participants

@nicolas-grekas@jderusse@mpdude@solverat@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp