coq_nvim icon indicating copy to clipboard operation
coq_nvim copied to clipboard

"cannot start a transaction within a transaction" on every key press

Open 9999years opened this issue 2 years ago • 1 comments

Sometimes, coq_nvim enters a state where every key press (in insert mode) triggers this error:

cannot start a transaction within a transaction
Traceback (most recent call last):
  File "/Users/wiggles/.local/share/nvim/site/pack/packer/start/coq_nvim/.vars/runtime/lib/python3.9/site-packages/pynvim_pp/logging.py", line 31, in with_suppress
    yield None
  File "/Users/wiggles/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/server/registrants/attachment.py", line 98, in cont
    await stack.bdb.set_lines(
  File "/Users/wiggles/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/databases/buffers/database.py", line 144, in set_lines
    await self._ex.asubmit(cont)
  File "/Users/wiggles/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/shared/executor.py", line 38, in asubmit
    return await to_thread(cast(Any, self.submit), f, *args, **kwargs)
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/wiggles/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/shared/executor.py", line 35, in submit
    return cast(_T, fut.result())
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py", line 446, in result
    return self.__get_result()
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/Users/wiggles/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/shared/executor.py", line 26, in cont
    ret = f(*args, **kwargs)
  File "/Users/wiggles/.local/share/nvim/site/pack/packer/start/coq_nvim/coq/databases/buffers/database.py", line 117, in cont
    with self._lock, with_transaction(self._conn.cursor()) as cursor:
  File "/opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/Users/wiggles/.local/share/nvim/site/pack/packer/start/coq_nvim/.vars/runtime/lib/python3.9/site-packages/std2/sqlite3.py", line 32, in with_transaction
    cursor.execute("BEGIN TRANSACTION")
sqlite3.OperationalError: cannot start a transaction within a transaction

I'm not entirely sure what causes this, so I'm opening this issue as a starting point while I attempt to narrow down the root cause. ~~I think it may be partially caused by null-ls.nvim — I didn't see this bug before I installed null-ls.~~ EDIT: @scottnuma ran into the bug without null-ls.nvim, so I think it's unrelated. To add further difficulty, the bug only seems to appear after nvim has been open for several hours, and goes away when I close and reopen nvim. I'll update this issue with additional details as I investigate.

System details / version numbers
$ nvim --version
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.7.2_1/share/nvim"

Run :checkhealth for more info

$ uname -a
Darwin san-fransisco 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64

9999years avatar Jul 14 '22 20:07 9999years

I'm also seeing this problem - also after nvim has been open for several hours and resolves upon restart. I haven't installed null-ls.nvim.

cannot start a transaction within a transaction
Traceback (most recent call last):
  File "/Users/scott/.vim/plugged/coq_nvim/.vars/runtime/lib/python3.9/site-packages/pynvim_pp/logging.py", line 31, in with_suppress
    yield None
  File "/Users/scott/.vim/plugged/coq_nvim/coq/server/registrants/attachment.py", line 98, in cont
    await stack.bdb.set_lines(
  File "/Users/scott/.vim/plugged/coq_nvim/coq/databases/buffers/database.py", line 144, in set_lines
    await self._ex.asubmit(cont)
  File "/Users/scott/.vim/plugged/coq_nvim/coq/shared/executor.py", line 38, in asubmit
    return await to_thread(cast(Any, self.submit), f, *args, **kwargs)
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/scott/.vim/plugged/coq_nvim/coq/shared/executor.py", line 35, in submit
    return cast(_T, fut.result())
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py", line 446, in result
    return self.__get_result()
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/Users/scott/.vim/plugged/coq_nvim/coq/shared/executor.py", line 26, in cont
    ret = f(*args, **kwargs)
  File "/Users/scott/.vim/plugged/coq_nvim/coq/databases/buffers/database.py", line 117, in cont
    with self._lock, with_transaction(self._conn.cursor()) as cursor:
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/Users/scott/.vim/plugged/coq_nvim/.vars/runtime/lib/python3.9/site-packages/std2/sqlite3.py", line 32, in with_transaction
    cursor.execute("BEGIN TRANSACTION")
sqlite3.OperationalError: cannot start a transaction within a transaction

System Details / Version Numbers

# nvim --version
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.7.2_1/share/nvim"

Run :checkhealth for more info
# uname -a
Darwin Scotts-MacBook-Pro.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64

scottnuma avatar Jul 21 '22 23:07 scottnuma

this one was unfixable until i rewrote the entire API client

https://github.com/ms-jpq/coq_nvim/pull/520/files

fixed now

ms-jpq avatar Sep 18 '22 06:09 ms-jpq