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

Fix for Lock Overwrite Issue in Multithreaded RootFillLock Handling #369

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

RaiqaRasool
Copy link
Collaborator

The issue occurs when multiple threads call RootFillLock. Each thread was independently creating its own lock and overriding the lock saved by the previous thread in m_root_fill_rw_lock. This resulted in only the last thread's lock being retained. When RootFillUnlock was invoked, all threads attempted to unlock the lock acquired by the last thread, leading to undefined behavior due to multiple unlock operations on the same lock.

Resolution:

To address this, an additional check is added after acquiring the write lock. If the lock for the event processor (proc) has already been initialized by another thread, that lock will be used. This prevents each thread from initializing a new lock and ensures that only one lock is used across threads.

@faustus123
Copy link
Collaborator

Line 236 introduces a small memory leak. The lock object should not be instantiated until inside the if-block that saves it.

@RaiqaRasool
Copy link
Collaborator Author

Line 236 introduces a small memory leak. The lock object should not be instantiated until inside the if-block that saves it.

Corrected!

@nathanwbrei nathanwbrei merged commit 38c0e9a into master Oct 10, 2024
9 checks passed
@nathanwbrei nathanwbrei deleted the rasool_jana2.3.2 branch October 10, 2024 20:28
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.

3 participants