allison-casey/HyREPL

Using Fireplace, some evals hang

Opened this issue · 1 comments

I wish I could find some rhyme or reason to this, but I can't. Here's a simple case...

If I eval (+ 1) with cpp, it almost always returns 1.

If I eval (+ "foo") it frequently just hangs. Though sometimes it doesn't, and I get the appropriate error message. And when it works, it tends to keep working.

It's not always errors either. I get the sense that larger responses are more likely to break it, but when I try to replicate that by playing with the amount of data returned, I can't. Once it starts working, it tends to keep working.

When the error message return values fail, I notice HyREPL logs much less.

New client
in: {'session': 'ba3780d0-69a9-4342-a070-364ef894dee5', 'file-path': '', 'op': 'load-file', 'file-name': '', file': '(in-ns \'user) \n\n\n\n\n\n\n\n\n\n\n(+ "foo")', 'id': 'fireplace-Vermouth-1460666707-9'}`
(+ "foo")`
  File "/home/robbie/Wrkspc/Hy/nlp/lib/python3.4/site-packages/HyREPL/middleware/eval.hy", line 335, in _hy_anon_fn_8
  File "/home/robbie/Wrkspc/Hy/nlp/hy/hy/importer.py", line 134, in hy_eval
    return eval(ast_compile(expr, "<eval>", "eval"), namespace)
 File "<eval>", line 1, in <module>
out: {'session': 'ba3780d0-69a9-4342-a070-364ef894dee5', 'root-ex': 'TypeError', 'status': ['eval-error'], 'ex': 'TypeError', 'id': 'fireplace-Vermouth-1460666707-9'}
out: {'session': 'ba3780d0-69a9-4342-a070-364ef894dee5', 'err': "unsupported operand type(s) for +: 'int' and 'str'", 'id': 'fireplace-Vermouth-1460666707-9'}
out: {'session': 'ba3780d0-69a9-4342-a070-364ef894dee5', 'status': ['done'], 'id': 'fireplace-Vermouth-1460666707-9'}

If the error message shows up, the log has additional calls where the workarounds are being applied, such as:

New client
in: {'op': 'eval', 'session': 'b4de29dc-0d4e-4de9-9d5e-cbc42deba238', 'id': 'fireplace-Vermouth-1460652806-172', 'code': '[(symbol (str "\\n\\b" (apply str (interleave (repeat "\\n") (map str (.getStackTrace *e)))) "\\n\\b\\n")) *3 *2 *1]', 'ns': 'user'}
out: {'session': 'b4de29dc-0d4e-4de9-9d5e-cbc42deba238', 'id': 'fireplace-Vermouth-1460652806-172', 'value': "['\\x08' '_hy_anon_fn_8' ('/home/robbie/Wrkspc/Hy/nlp/lib/python3.4/site_packages/HyREPL/middleware/eval.hy:335') 'hy_eval' ('/home/robbie/Wrkspc/Hy/nlp/hy/hy/importer.py:134') '<module>' ('<eval>:1') '\\x08' 'None' 'None' 'None']", 'ns': 'user'}
out: {'session': 'b4de29dc-0d4e-4de9-9d5e-cbc42deba238', 'status': ['done'], 'id': 'fireplace-Vermouth-1460652806-172'}

When it hangs, there is no "Client gone" message in the log until I CTRL-C from Vim.