swyddfa / lsp-devtools

Tooling for working with language servers and clients.
https://lsp-devtools.readthedocs.io/en/latest/
47 stars 8 forks source link

Cannot start agent #156

Closed gitonthescene closed 4 months ago

gitonthescene commented 4 months ago

I'm pretty sure I was able to do this a short while ago and I'm not sure what's changed. When I try to start the agent I get multiple stamina.retry_scheduled messages and when I issue a keyboard interrupt I get the following output:

➜  lsp-devtools agent -- /Users/XXXX/delme/.venv/bin/ngnklsp
stamina.retry_scheduled
stamina.retry_scheduled
stamina.retry_scheduled
^CTraceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/XXXX/.local/pipx/venvs/lsp-devtools/lib/python3.11/site-packages/lsp_devtools/agent/__init__.py", line 80, in main
    await asyncio.gather(
  File "/Users/XXXX/.local/pipx/venvs/lsp-devtools/lib/python3.11/site-packages/lsp_devtools/agent/client.py", line 63, in start_tcp
    async for attempt in retries:
  File "/Users/XXXX/.local/pipx/venvs/lsp-devtools/lib/python3.11/site-packages/stamina/_core.py", line 462, in __anext__
    return Attempt(await self._t_a_retrying.__anext__())
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXXX/.local/pipx/venvs/lsp-devtools/lib/python3.11/site-packages/tenacity/_asyncio.py", line 78, in __anext__
    await self.sleep(do)
  File "/Users/XXXX/.local/pipx/venvs/lsp-devtools/lib/python3.11/site-packages/stamina/_core.py", line 42, in _smart_sleep
    await asyncio.sleep(delay)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/tasks.py", line 649, in sleep
    return await future
           ^^^^^^^^^^^^
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/XXXX/.local/bin/lsp-devtools", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/XXXX/.local/pipx/venvs/lsp-devtools/lib/python3.11/site-packages/lsp_devtools/cli.py", line 57, in main
    return parsed_args.run(parsed_args, extra)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXXX/.local/pipx/venvs/lsp-devtools/lib/python3.11/site-packages/lsp_devtools/agent/__init__.py", line 87, in run_agent
    asyncio.run(main(args, extra))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 123, in run
    raise KeyboardInterrupt()
KeyboardInterrupt

➜ 

Here's the version of lsp-devtools I'm running:

➜  lsp-devtools --version
lsp-devtools v0.2.2
➜ 

And my OS: macOS Sonoma Version 14.2.1 (23C71)

I have no idea what's going on. When I run without lsp-devtools agent -- it seems to be fine.

gitonthescene commented 4 months ago

Closing for now as I have some more things I can test...

gitonthescene commented 4 months ago

FWIW, still not sure why I'm seeing different behavior posted above, but I had a bug in my server where it wasn't handling empty files properly. Fixing that bug seemed to make the issue above go away.

alcarney commented 4 months ago

Glad to hear that you were able to get it working in the end... interesting that an issue in your server appeared to break the agent though - will have to keep an eye for that!