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

Deadlock if aeron::Aeron object destroyed too quickly #844

Closed
lukeocamden opened this issue Feb 10, 2020 · 3 comments
Closed

Deadlock if aeron::Aeron object destroyed too quickly #844

lukeocamden opened this issue Feb 10, 2020 · 3 comments

Comments

@lukeocamden
Copy link

I managed to get a deadlock by destroying an aeron::Aeron object too quickly after its construction. It happens if m_isRunning = false in AgentRunner::close executes before atomic_compare_exchange_strong in AgentRunner::run (which sets AgentRunner::m_isRunning back to true thus the spawned thread never exits).

Should it be that AgentRunner::run checks while (!m_isClosed) instead of while (m_isRunning)? I think that would fix it so that a close-request can't be "missed". Or can you see a better way to fix this? Thanks!

@mjpt777
Copy link
Contributor

mjpt777 commented Feb 10, 2020

Can you check if this works for you now?

@lukeocamden
Copy link
Author

Thanks for the quick patch. I think this may now crash if if (m_isRunning) in close runs before m_isRunning = true; in run (because m_thread never gets joined so calls std::terminate in its destructor).

@lukeocamden
Copy link
Author

Just tested this and no more deadlock - thanks again.

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

3 participants