robotcode icon indicating copy to clipboard operation
robotcode copied to clipboard

[BUG] Load workspace (Lock takes too long) + imports issue

Open robrtx opened this issue 2 years ago • 1 comments

Bug description In last few days we observed an issue where builtin variable ${/} is not found (see attached screenshot). As a result all Resource and Varibles imports are highlighted in red together with all keywords in that file which depend on these imports.

What also typically happens is that the process of "RobotCode: Load workspace" (visible on the bottom bar of VS Code) will never finish and will keep loading forever.

It seems to be related to extension versions since 0.14.x, but I can not fully confirm this. We curtrently use the latest extension version 0.14.4

To Reproduce To reproduce this issue can be tricky, because it appears quite randomly. Sometimes it does not happen and sometimes it happens consistently.

The best way to reproduce it is to start VS Code with "pre-opened" .robot file - this means any .robot file which was left visibly open before VS Code was shut down last time.

It can also happen when .robot file is opened (switched to) before the process "RobotCode: Load workspace" is finished.

If the "pre-opened" file is of any different type then .robot file (for example .json) and at the same time the process "RobotCode: Load workspace" is left to finish it's job, then everything is ususally fine and the imports and keywords are not highlighted.

Another option for happy outcome is to open VS Code with all files initially closed and waiting for the process "RobotCode: Load workspace" to finish before any .robot files are open.

Expected behavior Builtin variable ${/} is recognized and Resource and Varibles imports are imported correctly.

Logs Example message from VSCode "Output" view for RobotCode Language Server:

/home/user/.vscode-server/extensions/d-biehl.robotcode-0.14.4/robotcode/utils/async_tools.py:482: UserWarning: Lock takes to long <Thread(DiscoveringProtocolPart.get_tests_from_workspace, started 139760492332800)>
  warnings.warn(f"Lock takes to long {threading.current_thread()}")

Environment We develop our Robot code inside Docker container running on Ubuntu 20.04 installed on remote Docker host (via SSH) . All libraries including the robocop, robotidy and the RobotCode extension itself are installed inside our dev container. The container is build from "python:3.9-bullseye" base image.

Installed versions:

  • VS Code Version [1.73.1]
  • RobotCode Version [0.14.4]
  • OS: [Debian GNU/Linux 11 (bullseye)]
  • Python Version [3.9.15]
  • RobotFramework Version [5.0]
  • robotframework-robocop [2.3.0]
  • robotframework-tidy [3.2]

Screenshots

See attached screenshots for more details and for messages from VSCode "Output" view for RobotCode Language Server builtin_slash

output_logs

robrtx avatar Nov 11 '22 18:11 robrtx

yes, this is hopefully already known, see also issue #98

we have deadlook that can happens sometimes and it is really hard to find, thats why I enabled these warnings in the latest release to get a hint where it hangs. so you screenshots are a big help for me.

please be patient, I try to fix this as soon as possible.

d-biehl avatar Nov 11 '22 20:11 d-biehl

can you try the latest version of robotcode?

d-biehl avatar Jan 06 '23 11:01 d-biehl

can you try the latest version of robotcode?

Sure, I will test it on Monday when I'm back at work.

robrtx avatar Jan 07 '23 21:01 robrtx

Hi,

So I tested the latest version of Robot Code (v0.20.0) and so far it looks like the problem is gone. I repeatedly opened various .robot files and .resource files and I have not seen any single issue with builtin variable ${/} being not recognized or with Resource and Varibles imports not being imported correctly.

From my point of view this issue can be closed.

Thank you very much and keep up the good work!

robrtx avatar Jan 09 '23 15:01 robrtx

Thanks for the feedback!

Then I will close this issue. If you still have problems, you can open it again.

d-biehl avatar Jan 09 '23 19:01 d-biehl

Unfortunately this has not solved the issue which is why I was forced to uninstall and start using Robot Framework Language Server instead 😔.

cool-html5 avatar Jan 09 '23 20:01 cool-html5

hello @cool-html5

what exactly is your problem? We have a problem with a the ${/} variable and that robotcode sometimes hangs?

d-biehl avatar Jan 09 '23 20:01 d-biehl

I no longer see the "RobotCode: Load workspace" loading for what seems like eternity. But when trying to go to definition of a keyword in a test case, it takes a long time and after a while I see the red squiggly line under everything, when I hover over that, it says:

Fatal: can't get namespace diagnostics ''>=' not supported between instances of 'NoneType' and 'int'' (TypeError)robotcode.diagnostics(TypeError)

cool-html5 avatar Jan 10 '23 17:01 cool-html5

image

cool-html5 avatar Jan 10 '23 17:01 cool-html5

@cool-html5 sorry, I cannot reproduce it here.

Can you put this snippet to your settings.json:

  "robotcode.languageServer.args": [
    "--log",
    "--log-level",
    "INFO",
    "--log-all",
  ],

this enables some more output logging in the "Output" View from VSCode (press CTRL-SHIFT+U) and then select in the right/top combobox something like "RobotCode Language Server mode..."

Now you should find more info about the error. Maybe you can copy the error or snippet from the log here.

Also there is a new "Preview Version" of RobotCode, can you try this too?

d-biehl avatar Jan 10 '23 20:01 d-biehl

@cool-html5 any news?

d-biehl avatar Jan 16 '23 13:01 d-biehl