bee icon indicating copy to clipboard operation
bee copied to clipboard

Running only one sampling process

Open nugaon opened this issue 5 months ago • 0 comments

Summary

Implement synchronization mechanism to ensure only one sampling process runs at a time in agent.go, and prevent concurrent calls to rchash endpoint which can cause race conditions and inconsistent state.

Motivation

Currently, multiple sampling processes can be triggered concurrently, leading to:

  1. Race conditions in the agent.go module
  2. Inconsistent state when multiple processes try to access and modify the same resources
  3. Performance degradation and increased error rates when rchash endpoint is called simultaneously
  4. Potential deadlocks or system instability under high load

Implementation

Potential implementation approaches: Add a mutex lock around the sampling process in agent.go

nugaon avatar Jul 23 '25 15:07 nugaon