-
Notifications
You must be signed in to change notification settings - Fork 409
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
Dependency checking regression #907
Comments
Hi @jtojnar, The current implementation of dependency cycle checking does not handle graphs. Instead, a dependency cycle is detected when the runtime state reaches a fixed point, that is, if the state does not evolve over two consecutive steps. Currently, the detection of the fixed point is based on the length of the list of items remaining to process. I'm guessing that the problem is that this does not identify fixed points correctly, and that your example is a false positive. I don't have much free time these days. It would be very helpful if you could reduce your example to an absolute smallest example which I can add as a test case, and work on a fix from there. Is this possible? |
I tried simplifying it a bit more. I also updated the graph generator to distinguish the non-done (dashed borders) nodes from the done (thicker borders). Looks like only the root nodes remain to be done: I tried to dump the Log
Patchdiff --git a/lib/Hakyll/Core/Runtime.hs b/lib/Hakyll/Core/Runtime.hs
index 0d05e5b..86ffd22 100644
--- a/lib/Hakyll/Core/Runtime.hs
+++ b/lib/Hakyll/Core/Runtime.hs
@@ -214,8 +214,10 @@ scheduleOutOfDate = do
--------------------------------------------------------------------------------
pickAndChase :: Runtime ()
pickAndChase = do
+ logger <- runtimeLogger <$> ask
todo <- runtimeTodo <$> getRuntimeState
unless (null todo) $ do
+ Logger.debug logger ("todo: " ++ show (M.keys todo))
acted <- mconcat <$> forConcurrently (M.keys todo) chase
when (acted == Idled) $ do
-- This clause happens when chasing *every item* in `todo` resulted in
@@ -375,6 +377,9 @@ chase id' = do
, runtimeFullDependencies = M.insertWith S.union id' (S.fromList reqs) (runtimeFullDependencies s)
}
+ Logger.debug logger ("deps: " ++ show deps)
+ Logger.debug logger ("reqs: " ++ show reqs)
+
-- Progress has been made if at least one of the
-- requirements can move forwards at the next pass
let progress | length deps < length reqs = Progressed |
I can make it succeed by considering empty --- a/lib/Hakyll/Core/Runtime.hs
+++ b/lib/Hakyll/Core/Runtime.hs
@@ -377,7 +379,7 @@ chase id' = do
-- Progress has been made if at least one of the
-- requirements can move forwards at the next pass
- let progress | length deps < length reqs = Progressed
+ let progress | length deps < length reqs || null deps = Progressed
| otherwise = Idled
return progress Log
|
I think this makes sense, and even further: what does an empty Should we just run |
Ahh yes, look here: modifyRuntimeState $ \s -> s
{ runtimeTodo = M.insert id'
(if null deps then c else compilerResult result) -- <----------- if null deps then move on to computing c
(runtimeTodo s)
-- We track dependencies only to inform users when an infinite loop is detected
, runtimeDependencies = M.insertWith S.union id' (S.fromList deps) (runtimeDependencies s)
} which means that your fix most probably right and was an oversight on my part. |
When I try to to build my site with Hakyll 4.15.1.0, it fails as follows:
Build log on 4.15.1.0
It worked with hakyll 4.14.0.0
Build log on 4.14.0.0
There is no cycle, according to the graph generated by #906:
Dependency graph
I recommend
xdot
for viewing the graphs. Edotor works in the web browser but does not support highlighting adjacent edges. Passing-f fdp
toxdot
might lay out the graph slightly more manageably.POC code: https://github.com/jtojnar/repro/tree/main/hakyll-poc-messed-cycle
Bisect points to 142fc79
cc @LaurentRDC
The text was updated successfully, but these errors were encountered: