python-lsp/python-lsp-server

Autoimports: sqlite3.OperationalError: database is locked

outp1 opened this issue · 1 comments

Hi. My autoimports didn't work well, so i tried to inspect my problem. All i found is error logs from lsp server like this:

[ERROR][2024-02-14 11:55:21] .../vim/lsp/rpc.lua:734	"rpc"	"/home/danya/.local/share/nvim/mason/bin/pylsp"	"stderr"	'Exception in thread Thread-1 (_reload_cache):\nTraceback (most recent call last):\n  File "/home/danya/.pyenv/versions/3.12.1/lib/python3.12/threading.py", line 1073, in _bootstrap_inner\n'
[ERROR][2024-02-14 11:55:21] .../vim/lsp/rpc.lua:734	"rpc"	"/home/danya/.local/share/nvim/mason/bin/pylsp"	"stderr"	"    self.run()\n"
[ERROR][2024-02-14 11:55:21] .../vim/lsp/rpc.lua:734	"rpc"	"/home/danya/.local/share/nvim/mason/bin/pylsp"	"stderr"	'  File "/home/danya/.pyenv/versions/3.12.1/lib/python3.12/threading.py", line 1010, in run\n'
[ERROR][2024-02-14 11:55:21] .../vim/lsp/rpc.lua:734	"rpc"	"/home/danya/.local/share/nvim/mason/bin/pylsp"	"stderr"	"    self._target(*self._args, **self._kwargs)\n"
[ERROR][2024-02-14 11:55:21] .../vim/lsp/rpc.lua:734	"rpc"	"/home/danya/.local/share/nvim/mason/bin/pylsp"	"stderr"	'  File "/home/danya/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/pylsp/plugins/rope_autoimport.py", line 71, in _reload_cache\n'
[ERROR][2024-02-14 11:55:21] .../vim/lsp/rpc.lua:734	"rpc"	"/home/danya/.local/share/nvim/mason/bin/pylsp"	"stderr"	'    autoimport.generate_cache(task_handle=task_handle, resources=resources)\n  File "/home/danya/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/rope/contrib/autoimport/sqlite.py", line 368, in generate_cache\n'
[ERROR][2024-02-14 11:55:21] .../vim/lsp/rpc.lua:734	"rpc"	"/home/danya/.local/share/nvim/mason/bin/pylsp"	"stderr"	'    self._execute(\n  File "/home/danya/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.12/site-packages/rope/contrib/autoimport/sqlite.py", line 643, in _execute\n'
[ERROR][2024-02-14 11:55:21] .../vim/lsp/rpc.lua:734	"rpc"	"/home/danya/.local/share/nvim/mason/bin/pylsp"	"stderr"	"    return self.connection.execute(query._query, *args, **kwargs)\n"
[ERROR][2024-02-14 11:55:21] .../vim/lsp/rpc.lua:734	"rpc"	"/home/danya/.local/share/nvim/mason/bin/pylsp"	"stderr"	"           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsqlite3.OperationalError: database is locked\n"

No related problems was found, except of recently works on something similar like #474 and #499

Any thoughts? I'm not a pylsp developer, so help would be really appreciated.

I can replicate this problem.

Looks like we are waiting on this PR, based on discussion here that references this thread.

Thanks all!

[stderr] Traceback (most recent call last):
[stderr]   File "/Users/rjohn/.pyenv/versions/3.11.6/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
[server-notification] Mon Mar 11 09:06:15 2024:
(:jsonrpc "2.0" :method "$/progress" :params
	  (:token "9ccbdcf4-7c06-4c6d-b01b-ff11ca765147" :value
		  (:kind "end")))
[stderr]     self.run()
[stderr]   File "/Users/rjohn/.pyenv/versions/3.11.6/lib/python3.11/threading.py", line 982, in run
[stderr]     self._target(*self._args, **self._kwargs)
[stderr]   File "/Users/rjohn/.pyenv/versions/3.11.6/envs/core/lib/python3.11/site-packages/pylsp/plugins/rope_autoimport.py", line 71, in _reload_cache
[stderr]     autoimport.generate_cache(task_handle=task_handle, resources=resources)
[stderr]   File "/Users/rjohn/.pyenv/versions/3.11.6/envs/core/lib/python3.11/site-packages/rope/contrib/autoimport/sqlite.py", line 368, in generate_cache
[stderr]     self._execute(
[stderr]   File "/Users/rjohn/.pyenv/versions/3.11.6/envs/core/lib/python3.11/site-packages/rope/contrib/autoimport/sqlite.py", line 643, in _execute
[stderr]     return self.connection.execute(query._query, *args, **kwargs)
[stderr]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stderr] sqlite3.OperationalError: database is locked```