Skip to content

[DX-2917] add a memory leak CRE soak test#21475

Merged
Tofel merged 3 commits intodevelopfrom
worktree-dx-2917-memory-leak-cre-test
Mar 11, 2026
Merged

[DX-2917] add a memory leak CRE soak test#21475
Tofel merged 3 commits intodevelopfrom
worktree-dx-2917-memory-leak-cre-test

Conversation

@Tofel
Copy link
Contributor

@Tofel Tofel commented Mar 10, 2026

Summary

  • Adds a scheduled memory-leak / soak test for CRE (Test_CRE_PoR_MemoryLeakSoak) that runs 20 V2 PoR workflows concurrently and asserts Prometheus CPU/memory metrics stay within thresholds after a configurable soak window (default 2 h).
  • Refactors por_test.go helpers into por_helpers.go (non-test file) so the new soak/cre package can import them.
  • Adds CronSchedule field to the V2 PoR WorkflowConfig to allow staggering 20 workflows across two 15 s-offset groups without rebuilding the binary.

Changes

  • soak/cre/soak_test.go — New 5-phase soak test: shared price provider → 20 workflow registrations → timed poll loop → per-workflow update assertions → leak.CLNodesLeakDetector CPU/memory check
  • smoke/cre/por_helpers.go — Extracted shared helpers from por_test.go (now exported). Adds SetupPoRWorkflowForSoak and GenerateSoakFeedIDs
  • smoke/cre/por_price_provider.go — Adds NewFakePriceProviderForSoak — single provider call for all 20 feed IDs, 300 prices per feed
  • smoke/cre/cre_suite_test.gobeforePoRTestBeforePoRTest (exported)
  • v2/.../types/types.go — Adds CronSchedule string field (omitempty, smoke tests unaffected)
  • v2/.../main.go — Uses config.CronSchedule when non-empty, defaults to */30 * * * * *
  • test-helpers/t_helpers.go — Adds porV2types.WorkflowConfig to the WorkflowConfig union + factory case
  • cre-soak-memory-leak.yml — New reusable CI workflow: ECR login → ctf obs up -f → start CRE → run test (4h20m timeout) → upload pprof
  • docker-build.yml — Adds soak-cre-memory-leak job triggered on schedule and push to develop
  • go.mod — Adds missing require entry for the v2 PoR module

@github-actions
Copy link
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

✅ No conflicts with other open PRs targeting develop

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Risk Rating: MEDIUM

Adds a long-running CRE PoR V2 soak test intended to detect memory/CPU leaks via Prometheus, plus supporting helper refactors and CI wiring to run it on a schedule.

Changes:

  • Adds a new CRE PoR memory-leak soak test that registers 20 staggered V2 workflows and checks on-chain updates + Prometheus resource thresholds.
  • Refactors/extends CRE PoR smoke-test helpers to support soak usage (shared price provider, per-workflow setup, generated feed IDs).
  • Adds CronSchedule override support to the V2 PoR workflow config and introduces a reusable GitHub Actions workflow to run the soak job.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
system-tests/tests/soak/cre/soak_test.go New long-running soak test with workflow registration, polling loop, and leak detector checks.
system-tests/tests/smoke/cre/por_helpers.go Exports setup helpers and adds soak-specific workflow setup + feed ID generation.
system-tests/tests/smoke/cre/por_price_provider.go Adds a single shared fake price provider variant for soak runs.
system-tests/tests/test-helpers/t_helpers.go Extends workflow config factory to support PoR v2 config generation and feed ID normalization.
core/scripts/cre/environment/examples/workflows/v2/proof-of-reserve/cron-based/types/types.go Adds CronSchedule to the v2 PoR workflow config.
core/scripts/cre/environment/examples/workflows/v2/proof-of-reserve/cron-based/main.go Uses CronSchedule when provided, otherwise defaults to */30 * * * * *.
.github/workflows/cre-soak-memory-leak.yml New reusable workflow to stand up CRE/observability and run the soak test.
.github/workflows/docker-build.yml Adds a job that invokes the reusable soak workflow (gated by an if).
system-tests/tests/go.mod Adds the missing module requirement for the v2 PoR workflow module (with local replace).
go.md Updates dependency graph docs.
system-tests/tests/smoke/cre/cre_suite_test.go Updates call sites for BeforePoRTest after export.
.gitignore Ignores additional local editor/tooling dirs.

Areas needing scrupulous human review:

  • system-tests/tests/soak/cre/soak_test.go: workflow registration loop, on-chain polling logic, and leak-check thresholds/warmup semantics.
  • system-tests/tests/test-helpers/t_helpers.go: v2 PoR feed ID normalization/truncation rules (ensure they match the actual on-chain ID encoding used everywhere).
  • .github/workflows/*: event gating/trigger behavior and AWS/ECR credentials/permissions for scheduled execution.

Reviewer recommendations (from CODEOWNERS):

  • CI/workflow changes: @smartcontractkit/devex-cicd / @smartcontractkit/devex-tooling (covers /.github/**).
  • go.md / repo-level deps: @smartcontractkit/core / @smartcontractkit/foundations.
  • No explicit CODEOWNERS entry for system-tests/ or core/scripts/cre/... was found; fallback ownership applies (@smartcontractkit/foundations / @smartcontractkit/core).
Comments suppressed due to low confidence (1)

system-tests/tests/smoke/cre/por_helpers.go:275

  • This loop/function doesn't compile and also appears to generate feed IDs with the wrong length:
  • for i := range n is invalid because range can't be used on an int.
  • The format string "018e16c3%02x0003200000000000000000" produces 36 hex chars (18 bytes), but the comment/doc expects 32 hex chars (16 bytes). This mismatch will break downstream code that assumes 16-byte feed IDs.
    Update the loop and format to generate exactly 16 bytes / 32 hex chars.

You can also share your feedback on Copilot code review. Take the survey.

@trunk-io
Copy link

trunk-io bot commented Mar 10, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

justinkaseman
justinkaseman previously approved these changes Mar 10, 2026
skudasov
skudasov previously approved these changes Mar 11, 2026
@cl-sonarqube-production
Copy link

@mchain0
Copy link
Contributor

mchain0 commented Mar 11, 2026

great idea

@Tofel Tofel closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants