test: add memory fragmentation test for coprocess#8123
Conversation
🚨 Jira Linter FailedCommit: The Jira linter failed to validate your PR. Please check the error details below: 🔍 Click to view error detailsNext Steps
This comment will be automatically deleted once the linter passes. |
|
This pull request introduces a new test case, The test simulates a large user session object and repeatedly calls the This change is isolated to the test suite and does not affect production code. It adds a valuable regression test for a potential memory issue in the gRPC plugin system. Files Changed Analysis
Architecture & Impact Assessment
sequenceDiagram
participant Test as TestCoProcess_MemoryFragmentation
participant GoRuntime as "Go Runtime"
participant OS as "Operating System (Linux)"
participant CoProcessor as "c.BuildObject"
Test->>GoRuntime: Force GC & Read Heap (initialHeap)
Test->>OS: Read VmRSS (initialRSS)
loop 10000 Times
Test->>CoProcessor: BuildObject(req, session, spec)
CoProcessor-->>Test: (object, nil)
alt Every 100 iterations
Test->>GoRuntime: Force GC
end
end
Test->>GoRuntime: Force GC & Read Heap (finalHeap)
Test->>OS: Read VmRSS (finalRSS)
Note over Test: Calculate heapDiff and rssDiff
Test->>Test: Assert rssDiff is significantly larger than heapDiff
Scope Discovery & Context Expansion
Metadata
Powered by Visor from Probelabs Last updated: 2026-04-21T17:12:02.257Z | Triggered by: pr_opened | Commit: 4474168 💡 TIP: You can chat with Visor using |
Security Issues (1)
Performance Issues (2)
Security Issues (1)
Performance Issues (2)
Powered by Visor from Probelabs Last updated: 2026-04-21T17:11:59.783Z | Triggered by: pr_opened | Commit: 4474168 💡 TIP: You can chat with Visor using |
|
API Changes no api changes detected |
Problem / Task
Implement a memory fragmentation test in
gateway/coprocess_test.goto prove that gRPC coprocess plugins cause OS-level memory fragmentation due to massive allocation churn.Changes
TestCoProcess_MemoryFragmentationtogateway/coprocess_test.go.BuildObjectin a loop to trigger allocation churn./proc/self/status) before and after the loop.Testing
TestCoProcess_MemoryFragmentationwhich passes successfully.go test -run=TestCoProcess_MemoryFragmentation -v ./gateway.Trace: ac0b37061b59b840fa19969a3c041fba
Generated with Visor AI Assistant