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

Using interpreter from generator leads to deadlock #2277

Open
sergej-koscejev opened this issue May 17, 2023 · 0 comments
Open

Using interpreter from generator leads to deadlock #2277

sergej-koscejev opened this issue May 17, 2023 · 0 comments
Assignees

Comments

@sergej-koscejev
Copy link
Member

When using an interpreter from the generator, the interpreter lookup mechanism uses underlying MPS/IDEA indices and sometimes blocks until the indices can be updated in a separate thread in a read action. If a write action becomes pending in the meantime, the indexing thread cannot acquire the read lock, while the write action cannot proceed until the generator finishes, leading to a deadlock.

Proposed solution:

Change the interpreter lookup mechanism to use the existing InterpreterExtensionPoint (MPS link) and never refer to the interpreter source nodes at run time.

To maintain backwards compatibility, proceed in stages. First, add getCategory() method to IInterpreter and generate it for all interpreters. We can add the method in a backwards compatible fashion by providing a default implementation but existing interpreters will have to be regenerated to return a proper value from this method.

Until we can be reasonably sure that all interpreters implement getCategory(), we cannot use it for lookups, so as an interim solution, continue looking up interpreters the old way but disable indexing while doing so.

After some time has passed, change the look up mechanism to use the extension point and the category.

Alternatively, we could use some feature flag mechanism to switch between the old and the new lookup and change the default mechanism over time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant