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

Modules are sensitive to deadlock #2

Open
calebzulawski opened this issue Jan 6, 2023 · 1 comment
Open

Modules are sensitive to deadlock #2

calebzulawski opened this issue Jan 6, 2023 · 1 comment

Comments

@calebzulawski
Copy link
Collaborator

I have a complex example of a function that returns a module, used by another module, results in a deadlock.

uses = { export = [make-module $args] } deadlocks, but

c++:Module :mod = make-module $args
...
uses = { export = [$mod] }

does not deadlock. Alternatively, uses = { export = [std:eval-id <| make-module $args] } also avoids the deadlock.

Interestingly, adjusting the scopes of variables within make-module can induce the deadlock even with these changes, which makes me think the problem is in the hypothetical make-module (which I have not been able to make a minimal reproduction for).

@afranchuk
Copy link
Collaborator

Yeah, this is almost certainly a deadlock in identity calculation. The calculation needs to be improved such that if a value's identity is being computed and it needs to compute its own identity as part of that, it'll just return 0 or some other fixed value. That's why it is caused by your make-module implementation, and why std:eval-id or evaluating the module earlier avoids the problem. Usually the only way to create recursive values (which could cause self-dependency in identities) is with load, since std:recurse automatically handles this.

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

2 participants