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

concurrency fixes for garbage collection #81

Merged
merged 2 commits into from
May 8, 2022
Merged

concurrency fixes for garbage collection #81

merged 2 commits into from
May 8, 2022

Conversation

kwantam
Copy link
Collaborator

@kwantam kwantam commented May 7, 2022

@alex-ozdemir reminded me that tests run concurrently, meaning we actually have to worry about deadlocking etc in the garbage collector. Mea culpa.

This PR makes the collector hold one lock (on TERMS, TYPES, or FOLDS) at a time.

It also adds a new lock, COLLECT, only in #[cfg(test)]. The collector takes this read-write; constant-folding and type-checking take it read-only. This means that garbage collection can't run while folding or typing is going on, which otherwise could potentially result in terms being collected while they're still needed.

@kwantam kwantam requested a review from alex-ozdemir May 7, 2022 15:59
Copy link
Contributor

@alex-ozdemir alex-ozdemir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, modulo the lock tweaks.

@kwantam kwantam merged commit 028f747 into master May 8, 2022
elefthei pushed a commit to elefthei/circ that referenced this pull request Oct 11, 2022
* concurrency fixes for garbage collection

* COLLECT lock even when not testing
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.

2 participants