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

DB_Analyze + Database is locked #1371

Closed
paranoidi opened this issue Aug 26, 2016 · 5 comments
Closed

DB_Analyze + Database is locked #1371

paranoidi opened this issue Aug 26, 2016 · 5 comments
Labels

Comments

@paranoidi
Copy link
Member

Log:

2016-08-26 12:17 INFO     db_analyze    task    Running ANALYZE on database to improve performance.
2016-08-26 12:19 WARNING  apscheduler.scheduler                 Execution of job "* (trigger: interval[1:00:00], next run at: 2016-08-26 12:19:02 EEST)" skipped: maximum number of running instances reached (1)
Exception in thread APScheduler:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/apscheduler/schedulers/blocking.py", line 30, in _main_loop
    wait_seconds = self._process_jobs()
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/apscheduler/schedulers/base.py", line 960, in _process_jobs
    jobstore.update_job(job)
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/apscheduler/jobstores/sqlalchemy.py", line 101, in update_job
    result = self.engine.execute(update)
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1991, in execute
    return connection.execute(statement, *multiparams, **params)
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
    return meth(self, multiparams, params)
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
    context)
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
    exc_info
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
    context)
  File "/home/xxx/apps/flexget/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
    cursor.execute(statement, parameters)
OperationalError: (sqlite3.OperationalError) database is locked [SQL: u'UPDATE apscheduler_jobs SET next_run_time=?, job_state=? WHERE apscheduler_jobs.id = ?'] [parameters: (1472206742.394899, <read-only buffer for 0x7fd6b4014be0, size -1, offset 0 at 0x7fd6a85a5ef0>, '4b7429f83440f1967e4c5e82c357e52d4911ee88')]
@paranoidi paranoidi added the Bug label Aug 26, 2016
@liiight
Copy link
Member

liiight commented Aug 26, 2016

Run with --debug-db-sessions if I remember the name correctly

@segelkma
Copy link

segelkma commented Sep 24, 2016

Hi, nearly a year ago I had the database locked issue as well, it just disappeared by itself for a time, but came back soon after, just was too lazy to follow up on this.
I recently installed the OS from scratch on my DS 215j, this time I used a cleaner installing method for flexget by using opkg instead of the package manager. The database locked error however is still there. I attached the whole log starting today 10am with --debug-db-sessions parameter. Within August I had 411 crash files with database locked errors.

crash_report.2016.09.24.120017673523.txt
crash_report.2016.09.24.123035310988.txt
crash_report.2016.09.24.133017777554.txt
crash_report.2016.09.24.140035551689.txt
crash_report.2016.09.24.143035321351.txt
flexget.txt

@dj-nitehawk
Copy link
Contributor

i've been seeing the same issue on my freshly installed ubuntu 16.04 server. no idea how to reproduce it cause it seems to be happening randomly. btw, my sqlite db was copied over from my old flexget installation on an ubuntu 12.04 server. maybe that has something to do with it?

@segelkma
Copy link

I don't think that an old database makes the issue persist, I tried it with a new one multiple times. I also just tried switching from python 2.7 to 3.5, but it didn't help.

@antivirtel
Copy link
Contributor

#1000 is related

cvium added a commit that referenced this issue Oct 6, 2018
* [fix] scheduler: the scheduler now uses a separate DB-file to avoid DB locks, fixes #2205, fixes #2025, maybe related #2198, fixes #1371
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants