Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37348

QSqlTableModel locks sqlite database and prevents write by other applications

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.2.0
    • SQL Support
    • None
    • Ubuntu 12.04.2 LTS
      sqlite version 3.7.9 (commandline interface)

    Description

      It seems QSqlTableModel in some cases blocks SQLite databases, i.e., prevents write access by another process. When running the attached application, the database given in the header of the QMessageBox is locked after the QMessageBox shows up. To try it, open a terminal window and type

      sqlite3 </path/to/database> "UPDATE main SET colorcode=1 WHERE id=5;"

      If DBSIZE (#defined in the attached source code) is sufficiently high (266 in my case, but could be different on other machines or operating systems), then I get "Error: database is locked".

      Once the QMessageBox has been closed, the database is open for write-access. And at that point, the database can be opened by several sqlite3 instances in parallel without blocking write-access. Thus, it is not a bug in sqlite but apparently a bug in Qt.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mabrand Mark Brand
            al__ Andreas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes