Skip to content
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

KeyError when raising ServerError #45

Closed
sorgfresser opened this issue Nov 6, 2024 · 5 comments
Closed

KeyError when raising ServerError #45

sorgfresser opened this issue Nov 6, 2024 · 5 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@sorgfresser
Copy link
Contributor

It seems that there is not always a desc key present if the result from Pantograph is an error.
For example I managed to produce the following json

{'error': 'timeout',
'message': "Timeout exceeded.\n<pexpect.pty_spawn.spawn object at 0x154b25f72390>\ncommand: PyPantograph/pantograph/pantograph-repl\nargs: [b'PyPantograph/pantograph/pantograph-repl', b'Mathlib', b'--maxHeartbeats=0', b'--maxRecDepth=100000']\nbuffer (last 100 chars): ''\nbefore (last 100 chars): ''\nafter: <class 'pexpect.exceptions.TIMEOUT'>\nmatch: None\nmatch_index: None\nexitstatus: None\nflag_eof: False\npid: 1032192\nchild_fd: 5\nclosed: False\ntimeout: 120\ndelimiter: <class 'pexpect.exceptions.EOF'>\nlogfile: None\nlogfile_read: None\nlogfile_send: None\nmaxread: 1000000\nignorecase: False\nsearchwindowsize: None\ndelaybeforesend: 0.05\ndelayafterclose: 0.1\ndelayafterterminate: 0.1\nsearcher: searcher_re:\n    0: re.compile('\\r\\n')\n    1: EOF"}

which raised a KeyError when trying to raise the ServerError in tactic_invocations because the desc key is missing.

@lenianiva lenianiva self-assigned this Nov 8, 2024
@lenianiva
Copy link
Member

This seems to be a problem of pexpect

@lenianiva lenianiva added bug Something isn't working help wanted Extra attention is needed labels Dec 6, 2024
@lenianiva
Copy link
Member

Should we lengthen the timeout?

@sorgfresser
Copy link
Contributor Author

Increasing the timeout was my workaround so far, yes.
Though I am not sure there is a perfect solution for the timeout. Parametrizing the timeout might be useful.

@lenianiva
Copy link
Member

Increasing the timeout was my workaround so far, yes. Though I am not sure there is a perfect solution for the timeout. Parametrizing the timeout might be useful.

The timeout's already parameterized https://github.com/lenianiva/PyPantograph/blob/309975657a1abef2b7a8a4e901da8874ed5ddd43/pantograph/server.py#L105

I don't want the timeout to be endless since if there's some bug or malformed tactic in Lean that hangs the system (nothing's preventing someone from writing one), then we must terminate the server process, but on the other hand not being able to run a IO-like monad with a timeout is a known limitation in Lean 4

@sorgfresser
Copy link
Contributor Author

Increasing the timeout was my workaround so far, yes. Though I am not sure there is a perfect solution for the timeout. Parametrizing the timeout might be useful.

The timeout's already parameterized

https://github.com/lenianiva/PyPantograph/blob/309975657a1abef2b7a8a4e901da8874ed5ddd43/pantograph/server.py#L105

I don't want the timeout to be endless since if there's some bug or malformed tactic in Lean that hangs the system (nothing's preventing someone from writing one), then we must terminate the server process, but on the other hand not being able to run a IO-like monad with a timeout is a known limitation in Lean 4

There are many reasons why the timeout shouldn't be endless. Since it is already parametrized, I'll close this issue for now. Simply increasing the timeout works. Nonetheless, the underlying KeyError raised within PyPantograph because the desc key was missing might not be ideal, but is certainly not a major issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants