Repository navigation
Conversation
A process-global OnceCell<Semaphore> meant the second http (or splunk_hec) generator in one lading process panicked at construction. Store an Arc<Semaphore> on each generator instead and acquire owned permits for request tasks; shutdown waits only on the generator's own permits. Dropping the last OnceCell use unmasked clippy's non_std_lazy_statics on the prometheus label regex, so switch it to std LazyLock and remove the now-unused once_cell dependency from the lading crate.
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 2 Pipeline jobs failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 15de4d7 | Docs | View more details | Give us feedback! |
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.
What does this PR do?
The
httpandsplunk_hecgenerators each keep their connection limiter in a process-widestatic CONNECTION_SEMAPHORE: OnceCell<Semaphore>. Only the first generator to start can set it. With twohttpgenerators in one config, lading panics at startup when the second one is constructed ("failed to set semaphore"). Twosplunk_hecgenerators panic the same way ("semaphore already set").This PR gives each generator its own
Arc<Semaphore>, sized from that generator'sparallel_connections. Request tasks hold owned permits from it. On shutdown,httpwaits only for its own in-flight requests.splunk_hecstill does not wait at shutdown, the same as before. A closed semaphore now returns a newSemaphoreClosederror instead of panicking. Configs with a single generator behave the same, and the config schema is unchanged.Removing the last
OnceCellmade clippy'snon_std_lazy_staticslint flag the Prometheus label regex. That regex now usesstd::sync::LazyLock, and theladingcrate no longer depends ononce_cell.Motivation
We want to replay a weighted mix of intake payloads in regression experiments. That takes several
httpgenerators, each with its own payload and rate, in one lading process.Additional Notes
New tests in
lading/src/generator/http/tests.rs. Each one runs real generators against local hyper servers for under a second of wall-clock time.two_generators_enforce_independent_limits: two generators with limits 1 and 3. Each target's peak number of concurrent in-flight requests equals that generator's own limit.shutdown_waits_only_on_own_requests: two generators with separate shutdown signals. Each target holds its first request open until the test releases it.acquire_manyremoved fromhttp.rs, this test fails.Checks run locally:
ci/validatepassed shellcheck, fmt, check, custom lints and clippy.ci/validatethen stopped atci/denyon two advisories: an out-of-bounds write inaes::unwrap_key, andpin-utilsbeing unmaintained. This PR adds neither crate; its onlyCargo.lockchange removesonce_cell.ci/validateskipped after that failure:ci/config-validation,ci/test(578 of 578 tests passed) andci/loom lading-signal(passed). Kani was not run.ladingbinary for 10s with twohttpgenerators (limits 1 and 4) posting to lading's ownhttpblackhole on a local port. Both generators sent requests, and lading exited 0 without panicking.No other generators or blackholes use a process-global semaphore or
OnceCell.