noneplugin/nonebot-plugin-chatrecorder

Database is locked

Closed this issue · 1 comments

接收到消息事件后引发了这样的错误导致无法记录对应消息

 07-30 19:00:01 [ERROR] nonebot | Error when running EventPostProcessors
Traceback (most recent call last):
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py", line 1965, in _exec_single_context
    self.dialect.do_execute(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\engine\default.py", line 921, in do_execute
    cursor.execute(statement, parameters)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 113, in execute
    self._adapt_connection._handle_exception(error)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 263, in _handle_exception
    raise error
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 95, in execute
    self.await_(_cursor.execute(operation, parameters))
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 125, in await_only
    return current.driver.switch(awaitable)  # type: ignore[no-any-return]
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 185, in greenlet_spawn
    value = await result
  File "C:\ProgramData\miniconda3\Lib\site-packages\aiosqlite\cursor.py", line 37, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "C:\ProgramData\miniconda3\Lib\site-packages\aiosqlite\cursor.py", line 31, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "C:\ProgramData\miniconda3\Lib\site-packages\aiosqlite\core.py", line 129, in _execute
    return await future
  File "C:\ProgramData\miniconda3\Lib\site-packages\aiosqlite\core.py", line 102, in run
    result = function()
sqlite3.OperationalError: database is locked

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\Bot\bot.py", line 16, in <module>
    nonebot.run()
  File "C:\ProgramData\miniconda3\Lib\site-packages\nonebot\__init__.py", line 333, in run
    get_driver().run(*args, **kwargs)
  File "C:\ProgramData\miniconda3\Lib\site-packages\nonebot\drivers\fastapi.py", line 199, in run
    uvicorn.run(
  File "C:\ProgramData\miniconda3\Lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\ProgramData\miniconda3\Lib\site-packages\uvicorn\server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\ProgramData\miniconda3\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
  File "C:\ProgramData\miniconda3\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "C:\ProgramData\miniconda3\Lib\asyncio\base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "C:\ProgramData\miniconda3\Lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\ProgramData\miniconda3\Lib\asyncio\base_events.py", line 607, in run_forever
    self._run_once()
  File "C:\ProgramData\miniconda3\Lib\asyncio\base_events.py", line 1922, in _run_once
    handle._run()
  File "C:\ProgramData\miniconda3\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\ProgramData\miniconda3\Lib\site-packages\nonebot\adapters\onebot\v11\bot.py", line 194, in handle_event
    await handle_event(self, event)
  File "C:\ProgramData\miniconda3\Lib\site-packages\nonebot\message.py", line 551, in handle_event
    await _apply_event_postprocessors(bot, event, state, stack, dependency_cache)
> File "C:\ProgramData\miniconda3\Lib\site-packages\nonebot\message.py", line 209, in _apply_event_postprocessors
    await asyncio.gather(
  File "C:\ProgramData\miniconda3\Lib\site-packages\nonebot\utils.py", line 186, in run_coro_with_catch
    return await coro
  File "C:\ProgramData\miniconda3\Lib\site-packages\nonebot\dependencies\__init__.py", line 108, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\ProgramData\miniconda3\Lib\site-packages\nonebot_plugin_chatrecorder\adapters\onebot_v11.py", line 58, in record_recv_msg
    await session.commit()
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 944, in commit
    await greenlet_spawn(self.sync_session.commit)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 192, in greenlet_spawn
    result = context.switch(value)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py", line 1920, in commit
    trans.commit(_to_root=True)
  File "<string>", line 2, in commit
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py", line 1236, in commit
    self._prepare_impl()
  File "<string>", line 2, in _prepare_impl
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py", line 1211, in _prepare_impl
    self.session.flush()
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py", line 4163, in flush
    self._flush(objects)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py", line 4298, in _flush
    with util.safe_reraise():
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 147, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py", line 4259, in _flush
    flush_context.execute()
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\unitofwork.py", line 466, in execute
    rec.execute(self)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\unitofwork.py", line 642, in execute
    util.preloaded.orm_persistence.save_obj(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\persistence.py", line 93, in save_obj
    _emit_insert_statements(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\orm\persistence.py", line 1226, in _emit_insert_statements
    result = connection.execute(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py", line 1412, in execute
    return meth(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\sql\elements.py", line 483, in _execute_on_connection
    return connection._execute_clauseelement(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py", line 1635, in _execute_clauseelement
    ret = self._execute_context(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py", line 1844, in _execute_context
    return self._exec_single_context(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py", line 1984, in _exec_single_context
    self._handle_dbapi_exception(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py", line 2339, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py", line 1965, in _exec_single_context
    self.dialect.do_execute(
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\engine\default.py", line 921, in do_execute
    cursor.execute(statement, parameters)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 113, in execute
    self._adapt_connection._handle_exception(error)
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 263, in _handle_exception
    raise error
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 95, in execute
    self.await_(_cursor.execute(operation, parameters))
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 125, in await_only
    return current.driver.switch(awaitable)  # type: ignore[no-any-return]
  File "C:\ProgramData\miniconda3\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 185, in greenlet_spawn
    value = await result
  File "C:\ProgramData\miniconda3\Lib\site-packages\aiosqlite\cursor.py", line 37, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "C:\ProgramData\miniconda3\Lib\site-packages\aiosqlite\cursor.py", line 31, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "C:\ProgramData\miniconda3\Lib\site-packages\aiosqlite\core.py", line 129, in _execute
    return await future
  File "C:\ProgramData\miniconda3\Lib\site-packages\aiosqlite\core.py", line 102, in run
    result = function()
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked