haiwen / seahub

The web end of seafile server.
seafile.com
Other
529 stars 367 forks source link

clearsession command always fails in cluster mode using MariaDB #1194

Open shoeper opened 8 years ago

shoeper commented 8 years ago
Start clear expired session records ...
Traceback (most recent call last):
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/contrib/sessions/management/commands/clearsessions.py", line 16, in handle
    engine.SessionStore.clear_expired()
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/contrib/sessions/backends/db.py", line 83, in clear_expired
    Session.objects.filter(expire_date__lt=timezone.now()).delete()
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/db/models/query.py", line 537, in delete
    collector.delete()
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/db/models/deletion.py", line 292, in delete
    qs._raw_delete(using=self.using)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/db/models/query.py", line 549, in _raw_delete
    sql.DeleteQuery(self.model).delete_qs(self, using)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/db/models/sql/subqueries.py", line 78, in delete_qs
    self.get_compiler(using).execute_sql(NO_RESULTS)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/db/models/sql/compiler.py", line 840, in execute_sql
    cursor.execute(sql, params)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/opt/seafile/seafile-pro-server-5.1.3/seahub/thirdpart/Django-1.8.10-py2.7.egg/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
django.db.utils.OperationalError: (1213, 'Deadlock found when trying to get lock; try restarting transaction')

Done

Done.

The session table is multiple hundred MiB in size. Running clearsession command as documented on manual.seafile.com always leads to the error above.

suspectpart commented 11 months ago

Any update on this? We encounter the same problem ...