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

Cyclic imports cause minigrace to run forever (command line only) #312

Open
apblack opened this issue Nov 11, 2019 · 0 comments
Open

Cyclic imports cause minigrace to run forever (command line only) #312

apblack opened this issue Nov 11, 2019 · 0 comments

Comments

@apblack
Copy link
Contributor

apblack commented Nov 11, 2019

If module A imports module B, and module B imports module A, minigrace will run forever — or until the host OS runs out of processes. It will start compiling A, which will launch a compile of B, which will launch a compile of A, and so on.

There used to be logic in xmodule that attempted to detect his situation — it was removed in commit 0cf0402 because it did not work. It used the modules entry of the compiled code's gct dictionary to detect imports, but because this entry is not available until after compilation has finished (and compilation never finished), the cycle-detection code was never run.

Instead, I believe that we need to build the imports graph before compilation starts. This graph could then be searched for cycles. As an added benefit, if no cycles are found, a topological sort of the graph will yield the dependencies for compiling the graph of modules that may enable some of them to be compiled in parallel.

@apblack apblack changed the title Cyclic imports cause minigrace to run forever (command lie only) Cyclic imports cause minigrace to run forever (command line only) Nov 20, 2019
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

1 participant