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

[HttpCache] Unlink tmp file on error#26727

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
fabpot merged 1 commit intosymfony:2.7fromChansig:issue-22719
Apr 1, 2018
Merged

Conversation

@Chansig
Copy link
Contributor

QA
Branch?2.7 up to 4.0 for bug fixes
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#22719
LicenseMIT
Doc PR

The tempnam function creates a unique temporary file for each call to a page to be cached, and if the temporary folder passed as an argument is not writable, tempnam will use /tmp.

Note: If PHP cannot create a file in the specified dir parameter, it falls back on the system default. On NTFS this also happens if the specified dir contains more than 65534 files.
http://php.net/manual/en/function.tempnam.php

Therefore, as soon as the HttpCache cache is no longer writable, the /tmp fills up fairly quickly, tempnam being called on every page (since no page cache) and creating a new unique file in /tmp.

See#22719


$tmpFile =tempnam(dirname($path),basename($path));
if (false ===$fp = @fopen($tmpFile,'wb')) {
@unlink($tmpFile);

Choose a reason for hiding this comment

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

you cannot unlink an opened file on Windows

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I think the file is not open when fopen returns false.

Choose a reason for hiding this comment

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

That's quite possible :)

@fabpot
Copy link
Member

Thank you@Chansig.

@fabpotfabpot merged commitc9a0355 intosymfony:2.7Apr 1, 2018
fabpot added a commit that referenced this pull requestApr 1, 2018
This PR was merged into the 2.7 branch.Discussion----------[HttpCache] Unlink tmp file on error| Q             | A| ------------- | ---| Branch?       |  2.7 up to 4.0 for bug fixes <!-- see below -->| Bug fix?      | yes| New feature?  |no <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets |#22719   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        |<!--Write a short README entry for your feature/bugfix here (replace this comment block.)This will help people understand your PR and can be used as a start of the Doc PR.Additionally: - Bug fixes must be submitted against the lowest branch where they apply   (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch.-->The tempnam function creates a unique temporary file for each call to a page to be cached, and if the temporary folder passed as an argument is not writable, tempnam will use /tmp._Note: If PHP cannot create a file in the specified dir parameter, it falls back on the system default. On NTFS this also happens if the specified dir contains more than 65534 files.http://php.net/manual/en/function.tempnam.php_Therefore, as soon as the HttpCache cache is no longer writable, the /tmp fills up fairly quickly, tempnam being called on every page (since no page cache) and creating a new unique file in /tmp.See#22719Commits-------c9a0355 [HttpCache] Unlink tmp file on error
This was referencedApr 2, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

5 participants

@Chansig@fabpot@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp