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

Make _isShutdown volatile #30

Merged
merged 1 commit into from Jun 27, 2022
Merged

Conversation

vemv
Copy link
Contributor

@vemv vemv commented Aug 6, 2021

It's read/written by different threads (particularly, it's read by the daemon thread defined in the Pool constructor).

Because access to the variable isn't guarded by a synchronized block or the volatile modifier, there isn't a visibility guarantee across threads.

This would be a reasonable explanation for a thread leak I'm experiencing.

@vemv vemv changed the title Make _isShutdown volatile Make _isShutdown volatile Aug 6, 2021
It's read/written by different threads (particularly, it's read by the daemon thread defined in the Pool constructor).

Because access to the variable isn't guarded by a synchronized block or the `volatile` modifier, there isn't a visibility guarantee across threads.

This would be a reasonable explanation for a thread leak I'm experiencing.
@KingMob
Copy link
Collaborator

KingMob commented Jun 27, 2022

@vemv Did making it volatile make your problem go away?

@vemv
Copy link
Contributor Author

vemv commented Jun 27, 2022

I think that I had an additional fix for an unrelated thing and that between both, dirigiste behaved better.

@KingMob
Copy link
Collaborator

KingMob commented Jun 27, 2022

I see no immediate errors in the tests of dirigiste, manifold, or aleph, so I'm merging.

@KingMob KingMob merged commit f1bda1b into clj-commons:master Jun 27, 2022
@vemv vemv deleted the volatile branch June 27, 2022 07:28
@vemv
Copy link
Contributor Author

vemv commented Jun 27, 2022

Thanks! 🍻

Yes, volatile only adds safety, it is extremely unlikely that it would make code incorrect.

@KingMob
Copy link
Collaborator

KingMob commented Jun 27, 2022

Yeah, but you never know when something depends on a bug... 😭

I would like to sunset Dirigiste, it seems to be flaky. We keep getting hard-to-reproduce OOM issues. If Loom/virtualThreads pan out, I may remove the Dirigiste executors entirely from Aleph/Manifold, and replace the connection pooling with something more battle-tested.

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.

None yet

2 participants