Zulip Chat Archive
Stream: general
Topic: lake stack overflow
Johan Commelin (Jul 15 2024 at 16:55):
chore(Data/Int/Defs): clear out Init/Data/Int/Basic #14759
In this PR lake build
just hangs, whereas lake exe cache clean
aborts with a stack overflow...
What is going on?
cc @Mac Malone
Ruben Van de Velde (Jul 15 2024 at 17:54):
I think it's been a loop in the import graph when I've had those symptoms
Henrik Böving (Jul 15 2024 at 17:55):
Lake should be capable of detecting import loops afaik
Ruben Van de Velde (Jul 15 2024 at 18:24):
"should" or "is"? :)
Ruben Van de Velde (Jul 15 2024 at 18:31):
Looks like my diagnosis was correct
Arthur Paulino (Jul 15 2024 at 18:48):
If not Lake, it wouldn't be too hard to upgrade cache
to detect cyclic dependencies before blowing up the stack by keeping track of a visited
data structure in the hashing routine
Henrik Böving (Jul 15 2024 at 18:52):
Ruben Van de Velde said:
"should" or "is"? :)
src/lake/Lake/Build/Fetch.lean:/-- A recursive build of a Lake build store that may encounter a cycle. -/
src/lake/Lake/Build/Fetch.lean:/-- Log build cycle and error. -/
src/lake/Lake/Build/Fetch.lean:@[specialize] def buildCycleError [MonadError m] (cycle : Cycle BuildKey) : m α :=
src/lake/Lake/Build/Fetch.lean: error s!"build cycle detected:\n{"\n".intercalate <| cycle.map (s!" {·}")}"
is
Ruben Van de Velde (Jul 15 2024 at 18:53):
I wonder what Johan ran into, then
Ruben Van de Velde (Jul 15 2024 at 18:53):
Does it catch a file importing itself directly?
Henrik Böving (Jul 15 2024 at 18:54):
@Mac Malone ?
Mac Malone (Jul 15 2024 at 19:01):
Yes, Lake does catch a file importing itself. There is even a test for that. Lake should be incapable of looping. However, it has been observed that a lake build
of Mathlib can hang with improper imports (though this does not happen if smaller subsets of Mathlib with the bad import are built). I have yet to figure out why.
Mac Malone (Jul 15 2024 at 19:05):
This example has given me some ideas, though, so I will take a look again.
Mac Malone (Jul 16 2024 at 03:20):
Sadly, my idea did not bear fruit. :-(
Last updated: May 02 2025 at 03:31 UTC