Skip to content

Close leaked resources and reap editor processes - #2580

Open
kojah wants to merge 1 commit into
encoredev:mainfrom
kojah:fix-resource-leaks
Open

kojah wants to merge 1 commit into
encoredev:mainfrom
kojah:fix-resource-leaks

Conversation

@kojah

@kojah kojah commented Sep 10, 2026 •

Copy link
Copy Markdown

The Prometheus remote-write exporter discards the response from http.Do, so every metrics push leaks the response body and its connection. This change closes the response body. It also closes the response body in fetchTemplates, the temporary config file handle in git-remote-encore, the gzip writer when writing the wasm release artifact fails, and the gzip reader in the runtime config parser.

Editor launches now call Wait in the background so detached processes are reaped instead of remaining as zombies on Unix for the daemon's lifetime.

Testing:

  • go build ./cli/cmd/encore
  • go build ./cli/cmd/git-remote-encore
  • go test ./cli/cmd/encore/app ./cli/cmd/git-remote-encore ./pkg/editors ./pkg/releaser/steps/tsparserwasm
  • From runtimes/go: go test ./appruntime/exported/config ./appruntime/infrasdk/metrics/prometheus

I found these issues through a static analysis tool I'm developing called gohawk. If you're interested, let me know and I can open a separate PR to add gohawk to your linter configuration :) You can view more comprehensive information about the project on the documentation website: https://gohawk.dev


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

This branch has not been deployed

No deployments
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