Skip to content

fix(xdebug-trace): pid-named temp dir, remove dirs of dead processes - #412

Merged
butschster merged 4 commits into
masterfrom
fix/xdebug-trace-tempdir
Nov 8, 2026
Merged

butschster merged 4 commits into
masterfrom
fix/xdebug-trace-tempdir

Conversation

@butschster

Copy link
Copy Markdown
Member

Stacked on #410 (base feat/xdebug-trace-storage). From the #410 review.

Problem

Memory storage mode keeps trace files in a temp dir removed at exit. A crash or kill -9 skips that, so up to keep × max_upload (2 GB by default) stays in the temp dir for good.

Fix

  • xdebugtrace.TempDir(base) makes <tmp>/buggregator-xdebug-traces-<pid>; at start it removes such dirs whose process is gone (and a leftover with its own pid). Dirs of live processes and other names are left alone.
  • Process check: kill(pid, 0) on Unix (EPERM = alive), os.FindProcess on Windows.
  • main.go uses it instead of os.MkdirTemp.

Tests

  • TestTempDir_RemovesDeadProcessDirs: dead child pid removed, live pid kept, own leftover emptied, other names kept.
  • go test -race -count=1 ./modules/xdebugtrace/ ok; go vet clean, also GOOS=windows go vet ./modules/xdebugtrace/.

Made with harnsy

…at start

In memory storage mode a crash or kill -9 skipped the cleanup at exit
and left up to keep x max_upload of traces in the temp dir for good.
The dir is now buggregator-xdebug-traces-<pid>; at start dirs whose
process is gone are removed.
@butschster butschster added the type: bug Something is broken or behaves incorrectly label Nov 8, 2026
@butschster
butschster marked this pull request as ready for review November 8, 2026 17:32
@butschster
butschster changed the base branch from feat/xdebug-trace-storage to master November 8, 2026 17:33
@butschster
butschster merged commit 1ff36d7 into master Nov 8, 2026
1 check passed
@butschster
butschster deleted the fix/xdebug-trace-tempdir branch November 8, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something is broken or behaves incorrectly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant