Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-1888

Improve database queries to anihile any deadlock

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.4.5
    • Component/s: Framework

      Description

      Issue

      Sentry Issue: NUXEO-DRIVE-VT and a lot more.

      OperationalError: database is locked
        File "nxdrive\engine\watcher\remote_watcher.py", line 608, in _handle_changes
        File "nxdrive\engine\activity.py", line 228, in func_wrapper
        File "nxdrive\engine\watcher\remote_watcher.py", line 693, in _update_remote_states
        File "nxdrive\engine\watcher\remote_watcher.py", line 665, in _get_changes
        File "nxdrive\engine\dao\sqlite.py", line 380, in store_int
        File "nxdrive\engine\dao\sqlite.py", line 365, in update_config
        File "nxdrive\engine\dao\sqlite.py", line 142, in execute
        File "nxdrive\engine\dao\sqlite.py", line 136, in execute
      

      Analysis

      The way the database does its commit is prone to deadlocks, resulting in lot of "database is locked" errors.
      The current journal_mode used is MEMORY, and here is what the doc states:

      The MEMORY journaling mode stores the rollback journal in volatile RAM. This saves disk I/O but at the expense of database safety and integrity. If the application using SQLite crashes in the middle of a transaction when the MEMORY journaling mode is set, then the database file will very likely go corrupt.

      New Mode

      We should use another journal_mode: WAL. According to the documentation, we will have only benefits. All disadvantages listed do not impact our product or how we use SQLite inside, which is quite interesting.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.