Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutex Locking needed to ensure thread safety in relpEngineDestruct function. #268

Open
sourav-sharma796 opened this issue Mar 5, 2025 · 0 comments

Comments

@sourav-sharma796
Copy link

There is a potential concurrency issue in the relpEngineDestruct where shared resources may be accessed simultaneously by multiple threads, leading to race conditions. To ensure thread safety and prevent inconsistent state, it is essential to add mutex locking inside for loops traversing over the pSessLstRoot and pSrvLstRoot for destructing sessions and servers in relpEngineDestruct function of relp.c file.

The proposed change involves:

  1. Add mutex lock inside for loop traversing pSessLstRoot and unlock after returning from relpSessDestruct function.
  2. Add mutex lock inside for loop traversing pSrvLstRoot and unlock after returning from relpSrvDestruct function.
  3. Testing the function under high-concurrency scenarios to ensure thread safety.

This change will help improve the reliability and stability of the function in multi-threaded environments and can protect from potential rsyslog crash during shutdown.

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

No branches or pull requests

1 participant