Zulip Chat Archive

Stream: lean4

Topic: automatically updating project


Jon Eugster (Dec 07 2023 at 17:47):

I have a script which periodically updates a lean project using lake update -R && lake build.

Now I just had a failure where lake update -R just went into an infinite loop without recovery. Deleting .lake/ solved the issue, but I'd prefer not to call rm -rf .lake/ just preemptively on every update.

  • Is there a recommendation for a more stable updating procedure? Would lake clean -R && lake update && lake build make a difference?
  • Are there any recommendation on how to debug this next time to provide a useful bug report? My hunch is that some download got corrupted (no space left or bad connection) and then lake could not recover next time it tried.

Sebastian Ullrich (Dec 07 2023 at 17:58):

A stacktrace would be very helpful for that

Mac Malone (Dec 07 2023 at 18:40):

Jon Eugster said:

Now I just had a failure where lake update -R just went into an infinite loop without recovery.

That seems like a serious bug that should never happen! I think the goal should just be to fix it. More information would be very helpful!

Jon Eugster (Dec 07 2023 at 19:36):

It's probably not that useful, but @Mac Malone here are the things I could read from the system logs:

Logs and stuff

Utensil Song (Dec 08 2023 at 05:53):

This is caused by lean4#2858, which has detailed explanations in the PR. The workaround is suggested here.

Jon Eugster (Dec 08 2023 at 09:37):

Thanks for digging that out. The fix you linked to is essentially the same I mention with curl, both just copy the relevant toolchain in manually.

I guess the take-away here is that mathlib's update-hook doesn't quiet work if you need it to be reliable.

The more interesting part about this log was the second half, but I'm sad I don't have enough information on that one to get anywhere

Utensil Song (Dec 08 2023 at 12:20):

The technical reason for why the post_update hook didn't work, is:

  1. the old lake runs lake update
  2. it got a new Mathlib, containing its new lakefile, using a new lake feature, like leanOption in your case
  3. the old lake can't process the new lakefile, so it failed with the error you see, before ever getting to process and execute the post_update defined in Mathlib's new lakefile

This is explained here.

Mario Carneiro (Dec 08 2023 at 12:22):

The second bug is that when lake update fails in (3) during elaboration, it leaves a olean.trace file which is empty, which is not valid json and so if you run lake update with new lake it will still complain unless you pass -R

Utensil Song (Dec 08 2023 at 12:23):

Very subtle indeed

Jon Eugster (Dec 08 2023 at 12:26):

And do you also know how this lead then to the process lake update -R just hanging up and not terminating for days, and also not complaining? That was the original question. All the things you describe are just part of how did we get lake in a bad state to start from.

Mario Carneiro (Dec 08 2023 at 12:29):

nope

Utensil Song (Dec 08 2023 at 12:37):

Do you have other lake processes on the same server? Possibly triggered by other users. Could it be lake waiting on another lake process on the same directory? I observed this before, but I'm not sure if such behavior is still there.

Jon Eugster (Dec 08 2023 at 12:41):

maybe it could be that one process crashed (maybe for outside reasons) without removing the lockfile and then in future all processes just waited, that's not a bad idea at all!

Utensil Song (Dec 08 2023 at 12:53):

The first bug is known to complain and exit. The second bug also exits immediately too (I've made .lake/lakefile.olean.trace empty):

% lake update
error: compiled configuration is invalid; run with `-R` to reconfigure

lake -R will recreate the .lake/lakefile.olean.trace whether it's empty or incomplete.

Also, I can't observe lake blocking on each other now.


Last updated: Dec 20 2023 at 11:08 UTC