-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Describe the bug
When the server crashes due to a stack-overflow (which can easily happen, for example when using norm_num on expressions containing large numbers), AutoLeanServer fails to properly restart it, probably due to corrupted session caches. (Not using session caches and manually rerunning initialisation code solves the problem).
To Reproduce
Your environment:
- OS: Linux, macOS,
- Python version: 3.12
- LeanInteract version: 0.9.2
Then the steps to reproduce the behavior.
Running this program:
from lean_interact import TempRequireProject, LeanREPLConfig, Command, AutoLeanServer
project = TempRequireProject(lean_version="v4.23.0", require="mathlib")
config = LeanREPLConfig(project=project, memory_hard_limit_mb=8000)
command = """
theorem mathd_numbertheory_328 : (5^999999) % 7 = 6 := by norm_num
"""
server = AutoLeanServer(config)
env = server.run(Command(cmd="import Mathlib"), add_to_session_cache=True).env
try:
# Larger timeout values sometimes fail to replicate the bug, especially on MacOS.
server.run(Command(cmd=command, env=env), timeout=1e-2)
except TimeoutError:
print("Timeout!")
print("Server not alive, so will be restarted.")
server.run(Command(cmd=command, env=env))leads to the following output:
Timeout!
Server not alive, so will be restarted.
and then exception:
ConnectionAbortedError: The Lean server closed unexpectedly.
--------------------------------------------------
stdout:
--------------------------------------------------
stderr:
libc++abi: terminating due to uncaught exception of type lean::exception: cannot evaluate `[init]` declaration 'Mathlib.Meta.NormNum.normNumExt' in the same module
--------------------------------------------------If stdout and stderr are empty or obscure, here is a list of possible reasons (not exhaustive):
- Not enough memory and/or compute available
- The cached Lean REPL is corrupted. In this case, clear the cache using the `clear-lean-cache` command.
- An uncaught exception in the Lean REPL
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels