Fix notify flood memory growth #611

Merged
paratoxic merged 3 commits from jobs-dos into master 2026-08-23 16:13:59 +00:00
Owner

Fixes this:

M4. Proxy: notify flood memory growth — src/jobs.rs:35-48

ckpool: ages out workbases older than 600 s, keeps at least 3, skips
in-use (stratifier.c:1081-1093). No rate limit.

Design:

  • Cap Jobs.valid at a constant (64 jobs). On insert, evict the oldest
    by JobId order when the cap is exceeded. Evicted job -> share gets
    StratumError::Stale (already the unknown-job path at
    stratifier.rs:766; does not touch the bouncer).
  • Count cap vs. ckpool's time window is a deliberate divergence: a time
    floor reintroduces unboundedness under flood; count is the correct
    simple bound and serves as backpressure.
  • Identical accumulation shape in pool mode (height-based clean means
    templates pile up per --update-interval within a block gap); the cap
    fixes both.
  • Local monotonic JobIds (upstream IDs stored as upstream_job_id in
    Job) make eviction order = insertion order; latest (max ID) is
    never evicted, so assert_invariants holds by construction.
  • Must respect pinned tests: multiple_jobs_accumulation (5 jobs
    retained) and assert_invariants (latest in valid). Cap >= 5
    keeps all existing tests green; 64 is generous (~10.7 min of history
    at default 10 s update interval, near ckpool's 600 s window).
  • Keep seen unbounded per seen_never_evicts_within_job_group
    growth is PoW-gated at 32 bytes per accepted share.
  • Implemented as BTreeMap + pop_first eviction (precedent:
    orphan_receipts: BTreeMap, router.rs:53); unit test
    check_evicts_oldest_beyond_cap covers both workbase types.
Fixes this: ## M4. Proxy: notify flood memory growth — `src/jobs.rs:35-48` **ckpool:** ages out workbases older than 600 s, keeps at least 3, skips in-use (`stratifier.c:1081-1093`). No rate limit. **Design:** - Cap `Jobs.valid` at a constant (64 jobs). On insert, evict the oldest by `JobId` order when the cap is exceeded. Evicted job -> share gets `StratumError::Stale` (already the unknown-job path at `stratifier.rs:766`; does not touch the bouncer). - Count cap vs. ckpool's time window is a deliberate divergence: a time floor reintroduces unboundedness under flood; count is the correct simple bound and serves as backpressure. - Identical accumulation shape in pool mode (height-based clean means templates pile up per `--update-interval` within a block gap); the cap fixes both. - Local monotonic `JobId`s (upstream IDs stored as `upstream_job_id` in `Job`) make eviction order = insertion order; `latest` (max ID) is never evicted, so `assert_invariants` holds by construction. - Must respect pinned tests: `multiple_jobs_accumulation` (5 jobs retained) and `assert_invariants` (`latest` in `valid`). Cap >= 5 keeps all existing tests green; 64 is generous (~10.7 min of history at default 10 s update interval, near ckpool's 600 s window). - Keep `seen` unbounded per `seen_never_evicts_within_job_group` — growth is PoW-gated at 32 bytes per accepted share. - Implemented as `BTreeMap` + `pop_first` eviction (precedent: `orphan_receipts: BTreeMap`, `router.rs:53`); unit test `check_evicts_oldest_beyond_cap` covers both workbase types.
Fix notify flood memory growth
Some checks failed
CI / ckpool (pull_request) Successful in 27s
CI / lint (pull_request) Failing after 3m5s
CI / test-linux (pull_request) Failing after 6m40s
79d11de081
Fix
Some checks failed
CI / ckpool (pull_request) Successful in 36s
CI / lint (pull_request) Successful in 4m3s
CI / test-linux (pull_request) Failing after 13m49s
0e28a4d037
Merge branch 'master' of ssh://git.parasite.dev/parasitepool/para into jobs-dos
Some checks failed
CI / lint (pull_request) Successful in 3m13s
CI / ckpool (pull_request) Successful in 32s
CI / test-linux (pull_request) Failing after 11m12s
88edc38801
paratoxic merged commit 723a80da08 into master 2026-08-23 16:13:59 +00:00
paratoxic deleted branch jobs-dos 2026-08-23 16:13:59 +00:00
Sign in to join this conversation.
No description provided.