Flexget: Database clean up resulting in crash

The problem

The database clean up results in a crash. It seems this is related to the VACUUM operations on the database. I already reinstalled Python, Flexget + all dependencies and trashed my database. But the problem persists.

Steps to reproduce:

During its normal run flexget performs a database clean up. his can also be triggered manually by the command below. Both give similar output. $ flexget database clean

flexget.log:

2016-12-30 14:44 INFO     manager       SD        Running database cleanup.
2016-12-30 14:44 INFO     db_vacuum     SD        Running VACUUM on database to improve performance and decrease db size.
2016-12-30 14:44 CRITICAL task_queue                    Database error while running a task. Attempting to recover.
2016-12-30 14:44 CRITICAL manager                       An unexpected crash has occurred. Writing crash report to /Users/me/.flexget/crash_report.2016.12.30.144427043731.log. Please verify you are running the latest version of flexget by using "flexget -V" from CLI or by using version_checker plugin at http://flexget.com/wiki/Plugins/version_checker. You are currently using version 2.8.14

crash_report.2016.12.30.144427043731.log:

2016-12-30 14:44 INFO     manager                       Running database cleanup.
2016-12-30 14:44 INFO     db_vacuum                     Running VACUUM on database to improve performance and decrease db size.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 469, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: cannot VACUUM from within a transaction

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

Traceback (most recent call last):
  File "/usr/local/bin/flexget", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/flexget/__init__.py", line 42, in main
    manager.start()
  File "/usr/local/lib/python3.6/site-packages/flexget/manager.py", line 327, in start
    self.handle_cli()
  File "/usr/local/lib/python3.6/site-packages/flexget/manager.py", line 354, in handle_cli
    options.cli_command_callback(self, command_options)
  File "/usr/local/lib/python3.6/site-packages/flexget/plugins/cli/database.py", line 16, in do_cli
    cleanup(manager)
  File "/usr/local/lib/python3.6/site-packages/flexget/plugins/cli/database.py", line 26, in cleanup
    manager.db_cleanup(force=True)
  File "/usr/local/lib/python3.6/site-packages/flexget/manager.py", line 896, in db_cleanup
    fire_event('manager.db_cleanup', self, session)
  File "/usr/local/lib/python3.6/site-packages/flexget/event.py", line 106, in fire_event
    result = event(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/flexget/event.py", line 23, in __call__
    return self.func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/flexget/plugins/generic/db_vacuum.py", line 22, in on_cleanup
    session.execute('VACUUM')
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 1107, in execute
    bind, close_with_result=True).execute(clause, params or {})
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1393, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 185, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 469, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) cannot VACUUM from within a transaction [SQL: 'VACUUM']

Additional information:

  • Flexget Version: 2.8.14
  • Python Version: Python 3.6.0
  • Installation method: pip3
  • OS and version: macOS 10.12.2

Flexget dependencies:

  • pathlib 1.0.1
  • jsonschema 2.5.1
  • pyparsing 2.1.10
  • SQLAlchemy 1.1.4
  • path.py 9.0.1
  • guessit 2.0.4
  • flask 0.12
  • flask-cors 3.0.2
  • apscheduler 3.3.1
  • cherrypy 8.6.0
  • flask-compress 1.3.2
  • terminaltables 3.1.0
  • flask-login 0.4.0
  • PyRSS2Gen 1.1
  • html5lib 0.999999999
  • requests 2.12.4
  • flask-restful 0.3.5
  • pynzb 0.1.0
  • colorclass 2.2.0
  • beautifulsoup4 4.5.1
  • jinja2 2.8.1
  • PyYAML 3.12
  • future 0.16.0
  • python-dateutil 2.6.0
  • rpyc 3.3.0
  • FeedParser 5.2.1
  • flask-restplus 0.8.6
  • Safe 0.4

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (17 by maintainers)

Commits related to this issue

Most upvoted comments

there’s a 2.7 log too above @paranoidi