robotcodedev / robotcode

RobotFramework support for Visual Studio Code
https://robotcode.io
Apache License 2.0
168 stars 13 forks source link

[BUG] RobotCode Language Server hangs - loop is not running #185

Closed sokol1412 closed 5 months ago

sokol1412 commented 8 months ago

Describe the bug Hi! I'm continously getting lock issues, which stops the RobotCode Language Server. After VSCode Reload/RobotCode LangueServer restart, it works fine for a while, but then reappears again (after some changes in Robot code are done).

Is it a known issue? I really love the extension, but having to restart every minute doesn't seem to be ok...

Response SendedRequestEntry(future=<Future pending cb=[FutureInfo._done(), <TaskWakeupMethWrapper object at 0x7fce887e8610>()]>, result_type=None) loop is not running.
/home/wadim/.vscode/extensions/d-biehl.robotcode-0.64.1/bundled/libs/robotcode/core/async_tools.py:473: UserWarning: Lock <robotcode.core.async_tools.Lock object at 0x7fce9a2121f0 [locked, waiters:1]> <Task pending name='Task-3239' coro=<_ImportEntry.__remove_filewatcher() running at /home/wadim/.vscode/extensions/d-biehl.robotcode-0.64.1/bundled/libs/robotcode/language_server/robotframework/diagnostics/imports_manager.py:113> wait_for=<Future pending cb=[FutureInfo._done(), <TaskWakeupMethWrapper object at 0x7fce887e8610>()]> cb=[FutureInfo._done()]> takes to long <Thread(SemanticTokensProtocolPart._text_document_semantic_tokens_full, started daemon 140524551927552)>
, try to cancel...
  warnings.warn(f"Lock {self} takes to long {threading.current_thread()}\n, try to cancel...")
/home/wadim/.vscode/extensions/d-biehl.robotcode-0.64.1/bundled/libs/robotcode/core/async_tools.py:473: UserWarning: Lock <robotcode.core.async_tools.Lock object at 0x7fce9a326f40 [locked, waiters:2]> <Task pending name='RobotDiagnosticsProtocolPart.collect_namespace_diagnostics' coro=<RobotDiagnosticsProtocolPart.collect_namespace_diagnostics() running at /home/wadim/.vscode/extensions/d-biehl.robotcode-0.64.1/bundled/libs/robotcode/language_server/robotframework/parts/diagnostics.py:76> wait_for=<Future pending cb=[FutureInfo._done(), <TaskWakeupMethWrapper object at 0x7fce887d1790>()]> cb=[FutureInfo._done(), <TaskWakeupMethWrapper object at 0x7fce98313af0>()]> takes to long <Thread(InlayHintProtocolPart._text_document_inlay_hint, started daemon 140525080405760)>
, try to cancel...
  warnings.warn(f"Lock {self} takes to long {threading.current_thread()}\n, try to cancel...")

Expected behavior RobotCode Language Server continues to run

Desktop:

d-biehl commented 8 months ago

yes, unfortunately this is a known problem that sometimes occurs. I'm working on a solution to this problem, but it's taking a little longer because I need to refactor and rework some internals of the robot code. My plan is to release a 1.0 version of RobotCode early next year, by then I want to have it fixed.

Is it possible for you to use a newer Python version? I've noticed that this bug doesn't occur as often with a Python version >= 3.10. Maybe it helps?

d-biehl commented 8 months ago

Have you enabled the robotcode.analysis.findUnusedReferences setting, if so, please disable it. This setting can also cause this bug.

sokol1412 commented 8 months ago

Hey, thank you for the suggestions!

No, I don't have the robotcode.analysis.findUnusedReferences option enabled.

I'll try to bump python version to >= 3.10 and see if it helped

d-biehl commented 5 months ago

The hole loop is not running errors are fixed with the big refactoring at the start of the year. This should not happens anymore.