Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database is locked #6

Closed
blueset opened this issue Jan 9, 2018 · 11 comments · Fixed by #110
Closed

Database is locked #6

blueset opened this issue Jan 9, 2018 · 11 comments · Fixed by #110

Comments

@blueset
Copy link
Member

blueset commented Jan 9, 2018

From @Gontid on July 27, 2017 14:31

Doesn't seem to affect functionality but I saw the following in the log file. Can someone explain what is wrong? Running ehForwarderBot on Centos 7.

return self.database.execute_sql(sql, params, self.require_commit)
  File "/usr/lib/python3.6/site-packages/peewee.py", line 3775, in execute_sql
    self.commit()
  File "/usr/lib/python3.6/site-packages/peewee.py", line 3598, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/usr/lib/python3.6/site-packages/peewee.py", line 135, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.6/site-packages/peewee.py", line 3768, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: database is locked

Appreciate your help!

Copied from original issue: ehForwarderBot/ehForwarderBot#68

@blueset
Copy link
Member Author

blueset commented Jan 9, 2018

Can you reproduce this error? If so, what are the steps to reproduce it?

@blueset
Copy link
Member Author

blueset commented Jan 9, 2018

From @Gontid on August 8, 2017 9:46

It shows up immediately after QR code is scanned and WeChat login is complete.

@blueset
Copy link
Member Author

blueset commented Jan 9, 2018

From @LiCongrui on August 8, 2017 15:12

I am the same problem, when I use "/chat" to send a wechat message.

@blueset
Copy link
Member Author

blueset commented Jan 9, 2018

Please ensure that there are no other process using tgdata.db before EFB is started, and ensure that EFB process has the permission to access that file.

@blueset
Copy link
Member Author

blueset commented Jan 9, 2018

From @lyckyercyber on September 7, 2017 16:15

same issue here
same trigger as 'I am the same problem, when I use "/chat" to send a wechat message.'
I'm sure 'there are no other process using tgdata.db before EFB is started, and ensure that EFB process has the permission to access that file.'

@blueset
Copy link
Member Author

blueset commented Jan 9, 2018

From @ddqp on November 30, 2017 9:29

same issue here,

@blueset
Copy link
Member Author

blueset commented Jan 9, 2018

As I cannot reproduce in my environment, I would like to seek help to those who can reproduce this issue stably.

@7nights
Copy link

7nights commented Feb 5, 2018

Same problem here... Any suggestions to solve this issue?

I cloned the repository and had a fresh start still cannot avoid this issue...

This happens every single time I wanna chat with someone by clicking the person showed after typing /chat.

BTW, I can still receive messages and reply to them but just cannot start a new conversation...

@yi-ji
Copy link

yi-ji commented Sep 8, 2018

same problem here too (cause failures to receive message sometimes)

To reproduce: /link or /chat, e.g.

Traceback (most recent call last):
  File "/home/jiy/.local/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 279, in process_update
    handler.handle_update(update, self)
  File "/home/jiy/.local/lib/python3.6/site-packages/telegram/ext/messagehandler.py", line 169, in handle_update
    return self.callback(dispatcher.bot, update, **optional_args)
  File "/home/jiy/.local/lib/python3.6/site-packages/efb_telegram_master/master_message.py", line 70, in msg_thread_creator
    threading.Thread(target=self.msg, args=(bot, update)).run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/jiy/.local/lib/python3.6/site-packages/efb_telegram_master/master_message.py", line 88, in msg
    assocs = self.db.get_chat_assoc(master_uid=utils.chat_id_to_str(self.channel_id, message.chat.id))
  File "/home/jiy/.local/lib/python3.6/site-packages/efb_telegram_master/db.py", line 140, in get_chat_assoc
    if len(slaves) > 0:
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 1688, in __len__
    self._ensure_execution()
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 1670, in _ensure_execution
    self.execute()
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 1587, in inner
    return method(self, database, *args, **kwargs)
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 1658, in execute
    return self._execute(database)
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 1809, in _execute
    cursor = database.execute(self)
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 2666, in execute
    return self.execute_sql(sql, params, commit=commit)
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 2660, in execute_sql
    self.commit()
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 2451, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 178, in reraise
    raise value.with_traceback(tb)
  File "/home/jiy/.local/lib/python3.6/site-packages/peewee.py", line 2653, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: database is locked

@blueset
Copy link
Member Author

blueset commented Sep 3, 2019

Marking as stale as no update in the past year.

@blueset blueset closed this as completed Sep 3, 2019
whtsky added a commit to whtsky/efb-telegram-master that referenced this issue Aug 10, 2021
whtsky added a commit to whtsky/efb-telegram-master that referenced this issue Aug 10, 2021
blueset pushed a commit that referenced this issue Aug 15, 2021
* fix: use SqliteQueueDatabase

See: https://www.reddit.com/r/learnpython/comments/ab0z3n/sqlite_database_locked_how_to_use_sqlite_with/

Fixes #6

* fix: add types-setuptools as tests_require

* fix: don't set journal_mode to OFF when creating table

SqliteQueueDatabase requires journal_mode to be WAL
@BillScott1024
Copy link

出现了相同的报错日志, 文字,图片信息可以接受,文件无法接受转发,报错日志如下:

image

YouXam pushed a commit to YouXam/efb-telegram-master that referenced this issue Apr 13, 2023
* fix: use SqliteQueueDatabase

See: https://www.reddit.com/r/learnpython/comments/ab0z3n/sqlite_database_locked_how_to_use_sqlite_with/

Fixes ehForwarderBot#6

* fix: add types-setuptools as tests_require

* fix: don't set journal_mode to OFF when creating table

SqliteQueueDatabase requires journal_mode to be WAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants