Skip to content

Stop srcHttp temp sinks from accumulating on disk - #22

Merged
pjeweb merged 2 commits into
mainfrom
fix/src-http-ephemeral-sink
Oct 1, 2026
Merged

pjeweb merged 2 commits into
mainfrom
fix/src-http-ephemeral-sink

Conversation

@pjeweb

@pjeweb pjeweb commented Oct 1, 2026

Copy link
Copy Markdown
Member

Summary

  • srcHttp with sink => true wrote each response to a pulp-http-* temp file and never deleted it. On a long-lived container that filled the writable layer (hundreds of GB of Mobilithek bodies).
  • The path-backed File now removes that temp file when it is released. A failed request deletes it immediately. A caller-supplied sink path is left in place, so the body still does not have to live as a PHP string while the File is in use.

Test plan

  • ./vendor/bin/phpunit --testsuite pulp (62 tests)
  • Review that sink => true still exposes a path-backed File until it is released, and that an explicit sink path survives a non-success status

sink => true left pulp-http-* files behind after each response, including failed requests. The path-backed File now removes the temp file it owns, and a caller-supplied sink path stays in place.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Cloned File objects independently delete the same backing path, potentially invalidating still-live clones.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Prevents temporary HTTP sink files from accumulating by tying cleanup to path-backed File lifetimes.

Changes:

  • Deletes ephemeral sinks after failures or file release.
  • Preserves caller-managed sink paths.
  • Adds lifecycle tests and documentation.
File Description
packages/​pulp/​src/​File.php Adds owned-path cleanup.
packages/​pulp/​src/​SrcHttpHandler.php Transfers or discards temporary sinks.
packages/​pulp/​Pulp.php Documents sink lifecycle.
packages/​pulp/​test/​FileTest.php Tests release cleanup.
packages/​pulp/​test/​SrcHttpHandlerTest.php Tests sink success and failure behavior.
packages/​pulp/​README.md Documents cleanup semantics.
packages/​pulp/​CHANGELOG.md Records the fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/pulp/src/File.php Outdated
split, shadow, and results clone path-backed files. A per-object unlink flag deleted the sink when the first clone was released.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

Shared ownership correctly prevents premature deletion while failure paths and caller-managed sinks are covered.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@pjeweb
pjeweb merged commit 5070404 into main Oct 1, 2026
8 checks passed
@pjeweb
pjeweb deleted the fix/src-http-ephemeral-sink branch October 1, 2026 11:54
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.

2 participants