`lake comparator` and bundled `nanoda_bin` on Windows: unspawnable `which` path, 1 MiB stack

Aperta
#16,866 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Ambito
backend, cli

Direzione di ricerca

Start with src/lake/Lake/CLI/Check.lean and trace how whichExe and bundledKernels select the nanoda executable for Windows. Then inspect how nanoda_bin.exe is built and compare its PE stack reserve with lean.exe and leanchecker.exe. Done means the comparator can start the bundled executable on Windows and large exports no longer overflow its main-thread stack.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Prerequisites
  • Check that your issue is not already filed: https://github.com/leanprover/lean4/issues
  • Reduce the issue to a minimal, self-contained, reproducible test case.
  • Test your test case against the latest nightly release.
  • When reporting a perceived soundness bug: Does it affect lake check --paranoid? (not a soundness bug)
Description

With leanprover/lean4:v4.37.0-rc1 on Windows 11 (x86_64), lake comparator --inadvisably-no-sandbox on a project with "enable_nanoda": true cannot run nanoda, and the bundled nanoda_bin.exe overflows its stack on large exports when run by hand.

  1. which lookup. whichExe in src/lake/Lake/CLI/Check.lean runs which. On Windows that only exists when Git's usr\bin is on PATH (Git\cmd alone is not enough), and what it prints is an MSYS path without the extension, for example /c/Users/<user>/.elan/toolchains/leanprover--lean4---v4.37.0-rc1/bin/nanoda_bin. Comparator then fails to start it:

    Running nanoda kernel on solution
    Error while interacting with nanoda kernel
    error: Error while interacting with nanoda kernel: no such file or directory (error code: 4058)
      file: /c/Users/<user>/.elan/toolchains/leanprover--lean4---v4.37.0-rc1/bin/nanoda_bin
    

    With v4.35.0 the same step failed with the system cannot find the file specified. (error code: 2). On master this is still the case: enable_nanoda inserts the bare name nanoda_bin, while bundledKernels builds the toolchain path with exeExtension; using that path, or not passing the which output to the spawn on Windows, would avoid it.

  2. Stack size of nanoda_bin.exe. Its PE header reserves 1 MiB for the main thread (SizeOfStackReserve), while lean.exe and leanchecker.exe reserve 100 MiB. On a 5.2 GB export it overflowed after about 6 minutes; a copy with only SizeOfStackReserve changed to 2 GiB checked the whole export (209,639 declarations, no errors). This is the main thread, separate from the worker-thread stacks discussed in #16290.

Steps to reproduce
  1. On Windows, with Git for Windows installed and its cmd and usr\bin directories on PATH, take a project whose comparator.json has "enable_nanoda": true.
  2. Export the challenge and solution with leanexport, then run lake comparator --inadvisably-no-sandbox --challenge-from-export=… --solution-from-export=….

Expected: comparator starts nanoda_bin.exe.
Actual: the error above, and comparator exits 1.

Versions

Lean (version 4.37.0-rc1, x86_64-w64-windows-gnu, commit 0b77e12952ad39077d80d8bd6b66d601f225c321, Release), Windows 11 Home 10.0.26200. Also seen with v4.35.0.

🤖 Generated with Claude Code

Lingua principale
Lean
Stelle
10.3k
Fork
1.1k
Merge medio
16h 45m
PR unite (30g)
361

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di leanprover/lean4

Tutte le issue di leanprover/lean4

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.