Repository navigation
Hidden bazel lockfile caching - #11
Closed
Silic0nS0ldier wants to merge 55 commits into
Closed
Silic0nS0ldier wants to merge 55 commits into
Silic0nS0ldier wants to merge 55 commits into
Conversation
- Available packs are discovered up-front to cull existance checks of evicted packs - Manifest lookup ordered by creation date so new entries are included when over max manifests limit. - Truncation of discovered manifests is now reported in metrics (boolean). - If cache entries are skipped due to prefix mismatch (indicating GH API acting out of spec), it is logged. Previously silently ignored.
- Pagination traversal now uses `Link` header for continuation. - Manifests skipped due to limit are now precisely reported.
- Manifests now include the hash of the pack they are for, so reads can be skipped if the associated pack is missing. This allows manifests to expire. - Ophaned manifests are reported in stats.
* Presence checks do not trigger pack downloads - Presence checks for blobs no longer trigger an eager download of packs. - To ensure packs containing blobs prescence checks included are not discarded, renewal is scheduled (skipped if downloaded before a timeout). Configurable with `--pack-renew-interval`. - Pack renewals are reported in stats. * Expose pack renewal duration in action interface
- Blobs in packs can now be zstd compressed. - Compression is configurable (off/on, level). - New stats for compressed blocks and saved bytes.
- gRPC can now be used in conjunction with HTTP - New stat `operations` tracks operations triggered by HTTP and gRPC calls. For identical builds using different transports, these should be able the same. - New stat `backend_requests` to measure traffic hitting GH (which has a quota that a high request volume can exhaust).
* Source server binaries from releases rather than version control * Validate tag inputs
- Add reap function to delete unmanifested packs that are unreachable. - Introduce EntryLister interface for listing cache entries with creation times. - Enhance RunOptions struct to include options for reaping packs. - Modify Run function to incorporate reaping logic and log reaped packs. - Create a new remover type to handle the deletion of packs and their manifests. - Update Layout struct to track unmanifested packs. - Implement tests for reaping functionality, ensuring correct behavior for old, recent, and unknown packs. - Update action.yml and main.js to support new inputs for reaping configuration. - Ensure that the publish budget and upload rate are correctly passed to the binary.
…unt formatting (#25)
…n for packs and manifests
…t miss (#28) Bazel stamps execution timestamps into every ActionResult, so any action uploaded twice (e.g. by overlapping CI runs) stored differing results under one key. The packed store then refused that key forever, silently, and every re-execution uploaded yet another result so it could never heal. Resolve such keys deterministically (lowest pack ID, then CID) in both the cache server and the optimiser layout, log a warning with the count at discovery, and let the optimiser reclaim the losing copies.
Flushing held packStore.mu across the pack and manifest uploads, so every read and presence check waited for each upload to finish. A pack download also takes p.mu while holding a backend slot, so a flush waiting for a slot deadlocked with finishing downloads until the backend timeout, and could re-enter the same deadlock immediately after. Flushes are now serialised by a dedicated mutex and only take p.mu for bookkeeping between backend calls.
…ping The optimiser rebuilt the same packs on every pass: it chose packs by waste alone, even when no grouping could improve them, so a pass re-uploaded gigabytes to reclaim megabytes. Unused entries could also sit in packs indefinitely when they were too small a share to trigger a rebuild. Eviction: entries no job has downloaded or presence-checked for evict-after-hours (default 168, matching GitHub's expiry of unused caches) are dropped from packs at least that old. Each affected pack is rewritten on its own, and keeps its age via a new optional `since` field on manifest pack descriptors, which older readers ignore. Packs with no used entries are left for GitHub to expire. Nothing is evicted unless the usage records provably cover the whole window. Records are now kept per job rather than one per run, so entries used by any job in a run are never mistaken for unused. Reshaping: only packs at least twice the eviction threshold old are regrouped, and only when at least two qualify. A pack is rebuilt only if the regrouping cuts its restore cost by min-improvement, measured on held-out runs so it does not chase noise in the window. Grouping uses a per-download overhead (download-overhead-mb) so small packs restored by the same jobs merge, and caps entries per pack below the manifest entry limit. Also: rebuilds publish concurrently with a concurrency-safe repacker that shares source pack downloads, manifests whose pack is gone are reaped under reap-unmanifested-packs, and the job summary reports eviction, overfetch and downloads per job. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bazel fans uploads out to roughly 10k concurrent ByteStream writes (100 connections x 100 streams). Each upload spooled to disk with unbounded os.CreateTemp, write, and fsync calls, and every blocking file syscall pins an OS thread. A large burst, such as uploading the llvm-project repo contents, exceeded the Go runtime's 10k-thread limit and aborted the server with "fatal error: thread exhaustion", failing the build with UNAVAILABLE and then connection refused. Gate each blocking spool filesystem call through a 64-slot ioGate. Slots are held only for the duration of a syscall, never across network reads, so a slow client cannot starve other uploads, and goroutines queued on the gate hold no thread. Queued calls honour request cancellation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes a panic on two-block frames reachable through the zstd block codec, flagged by govulncheck. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ole (#32) The post step printed only the last 16 KB of the server log. When the server crashed, the runtime's goroutine dump filled that window and pushed the fatal error, and everything before it, out of view. - Print an excerpt with the log's first lines, the start of any Go runtime crash (panic:, fatal error:, runtime:), and its last lines, cut on line boundaries with the omitted size marked. The main step's startup-failure message uses the same excerpt. - Publish the whole log as a job artifact, named by the new log-artifact input (default bazel-cache-server-log; empty disables). The post step runs the server binary's new upload-artifact subcommand, reusing the existing artifact uploader, since a crashed server cannot publish its own log. Logs over 256 MiB keep their first and last 128 MiB. - Save the log state before startup so a server that never became ready still has its log published. A failed upload warns and never fails the job. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Compute heads from all loaded manifests instead of relying on CID sort order. This prevents a child visited before its parent from leaving that parent marked as a head, bloating the parents list of later manifests. Example: the child sorts before the parent, but the child is still the only head. ```mermaid graph LR C[Child sorts first] -->|parent| P[Parent sorts later] C:::head classDef head fill:#dff0d8,stroke:#3c763d ``` The regression test covers layout heads, server discovery, and the parents written by a later flush. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stop retaining action closure-pack lists that runtime validation does not use, omit raw block metadata that readers can reconstruct, and compact the long-lived CAS index by deriving content CIDs and reusing pack IDs. Example: many CAS entries reference the same pack and each raw block is determined by its digest. ```mermaid graph LR P[One pack ID] --> C1[CAS digest 1] P --> C2[CAS digest 2] C1 -. derives raw CID and block .-> H1[Digest 1] C2 -. derives raw CID and block .-> H2[Digest 2] ``` Keep the format-2 closure field empty for older readers, and keep compressed block metadata explicit. Add wire-shape and compact-index regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reuse the verified asset download spool in the existing cache publication path. This avoids copying, hashing, and syncing the same bytes a second time while preserving packed staging and local object retention. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Order rebuild groups by their share of source-pack size so completing groups can retire source packs sooner during partial optimization passes. Group contents and packing decisions are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wait for an upload-rate reservation before acquiring a backend transfer slot. Recheck start spacing after acquiring a slot, releasing it while waiting when necessary, so delayed acquisitions do not bunch uploads into bursts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace future timestamp reservations with retry-based start spacing, so canceled waits do not leave unused gaps. Keep backend slots free while the server waits, and open repacker files before rate limiting. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid forcing ephemeral cache-directory spools to disk before they are uploaded or consumed. os.CreateTemp already creates private mode-0600 files, so the extra chmod is unnecessary. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build, attest, and publish the Darwin ARM64 server in releases and pre-releases. Add platform-aware binary resolution and native macOS CI and smoke coverage while keeping the optimiser Linux-only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add Windows x64 and ARM64 cache server support Publish Windows server executables with checksums and provenance. Handle native architecture selection, process cleanup, and Windows spool file lifetimes; add lifecycle tests and native Windows CI and smoke coverage. Keep the optimiser Linux-only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Windows asset and pack cleanup in CI Close asset spool handles before deletion and close restored pack readers in tests. Quote Windows workflow arguments and use an array for optional race flags to satisfy ShellCheck. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
|
Whoops! Forgot to change the target. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A port of https://github.com/Silic0nS0ldier/vscode-git-monolithic-extension/tree/1f0da5fa74c3a25d8b30a1fbce771e71bdf192b8/.github/actions/bazel-hidden-lockfile.