The in-memory db map in our repository is currently not safe for concurrent use. Concurrent SET or DEL operations from multiple clients could potentially lead to race conditions, which may cause unexpected behavior or data corruption.
Steps to Reproduce
- Run the service with multiple clients performing write operations (SET/DEL) concurrently.
- Observe potential data race conditions or inconsistent application behavior.
Expected Behavior
The in-memory database should handle concurrent operations safely, ensuring that race conditions do not occur.
Proposed Fix
Add synchronization (e.g., mutex locking) around the write operations to the db map to prevent concurrent access issues.
Additional Context
Identify the functions performing write operations and apply the appropriate locking mechanism without impacting overall performance.
The in-memory
dbmap in our repository is currently not safe for concurrent use. ConcurrentSETorDELoperations from multiple clients could potentially lead to race conditions, which may cause unexpected behavior or data corruption.Steps to Reproduce
Expected Behavior
The in-memory database should handle concurrent operations safely, ensuring that race conditions do not occur.
Proposed Fix
Add synchronization (e.g., mutex locking) around the write operations to the
dbmap to prevent concurrent access issues.Additional Context
Identify the functions performing write operations and apply the appropriate locking mechanism without impacting overall performance.