You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows unit tests red on main since 2026-09-07: per-server log writer is never closed #1266
Unit Tests (windows-latest, 1.25) on main has failed on every push since 2026-09-07 (519c1d241; last green b2a1cdb88). It only runs on push to main, so PRs never see it. Not release-gating (release.yml does not depend on it), but main is red.
Failing tests
All in internal/server, all with the same shape:
--- FAIL: TestGetServerLogs_MissingFileReturnsEmptyNotError (1.93s)
testing.go:1369: TempDir RemoveAll cleanup: unlinkat C:\Users\RUNNER~1\AppData\Local\Temp\...\server-never-logged.log: The process cannot access the file because it is being used by another process.
Also TestGetServerLogs_UnknownServerStillErrors, TestDiagnosticFixer_OAuthReauth_{ReachesTheCoordinator,DryRunDoesNotSignIn,RespectsWriteGates/*}, TestDiagnosticFixer_StdioShowLastLogs_{ReturnsRealTail,BoundsThePayload,MissingLogIsAFailure,CapCountsItsOwnFraming} (added by #1216 / #1218).
Root cause
The per-server upstream log writer is a lumberjack.Logger wrapped in zapcore.AddSync (internal/logs/logger.gocreateFileCore → CreateUpstreamServerLogger, consumed at internal/upstream/core/client.go:264). Nothing ever closes it: Server.Shutdown() / client disconnect only Sync() the zap logger, so the file handle stays open for the life of the process. On Linux/macOS RemoveAll unlinks an open file; on Windows it cannot, and t.TempDir() cleanup fails the test. The fixture comments in server_logs_missing_file_test.go / diagnostics_fixers_test.go already describe fighting this ("a per-server log writer that outlive Shutdown and then race t.TempDir()'s RemoveAll").
Fix
Give the upstream logger an owner that can close it: return the *lumberjack.Logger (or an io.Closer) from CreateUpstreamServerLogger, hold it on core.Client, and close it in the client's disconnect/close path so Server.Shutdown() releases every per-server file. That is also the product fix — a long-running core currently accumulates one open handle per server it has ever logged for. Once fixed, add a Windows-only leak check to the fixture (t.TempDir() already does it for free).
Same root cause takes down the E2E Tests workflow on main too: its End-to-End Tests (windows-latest, 1.25) leg runs the same internal/server package and fails on the identical eleven tests (e.g. run 34685615417), and the ubuntu/macos legs are then cancelled by the matrix. E2E has been red on every main push since 4e304ba04 (2026-09-07) for this reason alone.
Activity
Dumbris commentedon Sep 12, 2026
Same root cause takes down the
E2E Testsworkflow on main too: itsEnd-to-End Tests (windows-latest, 1.25)leg runs the sameinternal/serverpackage and fails on the identical eleven tests (e.g. run 34685615417), and the ubuntu/macos legs are then cancelled by the matrix. E2E has been red on every main push since4e304ba04(2026-09-07) for this reason alone.ci: give the Windows unit-test leg a 20m package timeout (#1269)
fix(logs): release the per-server log sink on every Disconnect (smart…