Skip to content

Database error: Database is locked #5680

Closed

Description

@jancborchardt

Another database issue. Right before this I uploaded 3 files and before that I moved 2 files to a new folder.

An exception occurred while executing 'DELETE FROM "oc_permissions" WHERE "fileid" = ?': SQLSTATE[HY000]: General error: 5 database is locked

cc @DeepDiver1975 @bartv2 @PVince81

Activity

  1. kiranos commented on Nov 4, 2013

    @kiranos

    you didnt check if mysql for example: mysql> "show full processlist ;" to see the active mysql questions that are locking, might give a hint on which script is issuing the question.

  2. VicDeo commented on Nov 4, 2013

    @VicDeo
    Contributor

    IMO locking is exclusively related to Sqlite.

  3. kiranos commented on Nov 4, 2013

    @kiranos

    yea thought more about the equivalent for sqlite, seems to be:

    "You can look into sp_who and sp_who2 to see if they give you what you need. Otherwise, SQL Profiler can often help with problem diagnoses." just thinking it would help to know the question that is activly locking the db.

  4. jancborchardt commented on Nov 4, 2013

    @jancborchardt
    ContributorAuthor

    Yeah, the database is SQLite, hence tagged this issue like that. The problem went away after a refresh but it’s still confusing and might point to a different problem?

  5. PVince81 commented on Nov 4, 2013

    @PVince81
    Contributor

    Someone told me that SQLite has a database based lock, which means that every access to the DB locks every other connection out for a while. Not sure whether the message you saw was due to a timeout when the lock took too much time.
    Then comes the question about what was accessing your DB for so long 😟

  6. kiranos commented on Nov 4, 2013

    @kiranos

    yea and there lies the problem, without seeing the active questions in the db at the time I feel this bug needs to be closed and reopened again with additional info if the issue re occurs. Knowing which questions that were active seems crusial.

  7. bantu commented on Nov 4, 2013

    @bantu

    Please provide more information. Are you accessing the sqlite database in any other way than ownCloud? E.g. using a sqlite browser. Which version of PHP are you using? Which version of sqlite is this? Which operating system is this on?

    For reference: See http://www.sqlite.org/lockingv3.html for information SQLite 3 locking.

  8. bantu commented on Nov 4, 2013

    @bantu

    SQLite can't properly deal with concurrent accesses. It it very likely that a background job kept the database busy which ended up in a timeout for the actual webinterface access. @PVince81 Does that make sense to you?

  9. PVince81 commented on Nov 5, 2013

    @PVince81
    Contributor

    @bantu yes, sounds likely. Just not sure what kind of background job it could be without further information.

  10. jancborchardt commented on Nov 5, 2013

    @jancborchardt
    ContributorAuthor
    • No, ownCloud is the only way which the database is being accessed. I sometimes access it via sqlite3 but only to recover ownCloud from error states. ;)
    • PHP version 5.5.1
    • sqlite3 version 3.6.20
    • CentOS release 6.4 (Final)

    Any more info you need?

  11. bantu commented on Nov 5, 2013

    @bantu

    @jancborchardt Thanks.

    @PVince81 Would it be possible to find out which job was running given the access log of the webserver?

    @jancborchardt Do you remember when exactly you got the error?

  12. VicDeo commented on Nov 5, 2013

    @VicDeo
    Contributor

    @jancborchardt and there is no sync client or mobile app that is configured to sync with this instance?

  13. jancborchardt commented on Nov 5, 2013

    @jancborchardt
    ContributorAuthor

    @bantu as said above: »Right before this I uploaded 3 files and before that I moved 2 files to a new folder.« They were images, each only ~300kB. This happened while I was using the web interface exclusively.

    @VicDeo yes there are. No desktop sync client atm but 2 Androids and an iOS device (I only access one of the Androids frequently).

  14. bantu commented on Nov 5, 2013

    @bantu

    @jancborchardt I mean timewise, as in absolute time. E.g. 5 Nov 2013, 12:34

  15. jancborchardt commented on Nov 5, 2013

    @jancborchardt
    ContributorAuthor

    As far as I remember I filed the issue right when it occured: 2013-11-03 12:04:10

  16. 12 remaining items

  17. ukirfan commented on Jan 2, 2014

    @ukirfan

    getting error message on accesing through web

    "An exception occured while executing insert into oc_permissions ('permissions' , 'user', 'field) '".....

    i am using owcloud 6 and installed on iis server with mysql as database

  18. karlitschek commented on Jan 3, 2014

    @karlitschek
    Contributor

    @ukirfan How is this related to the original issue described here? I suggest that you open a new issue as described in the issue template here. Thanks. https://github.com/owncloud/core/blob/master/CONTRIBUTING.md

  19. bartv2 commented on Mar 11, 2014

    @bartv2
    Contributor

    Sqlite doc about this: https://www.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked
    None of the listed points can happen in Owncloud, maybe the NFS one.
    @jancborchardt is you database accessed through NFS?

  20. jancborchardt commented on Mar 12, 2014

    @jancborchardt
    ContributorAuthor

    As this issue is 4 months old, I have trouble reproducing this.

  21. cdamken commented on May 19, 2014

    @cdamken
    Contributor

    I have that problem again, I have a description and some new logs:

    • Webdav Client (Microsoft-WebDAV-MiniRedir/6.1.7601).
    • Apache Version 2.2.22-13+deb7u1
    • Php Version 5.4.4-14+deb7u9
    • ownCloud Version 5.0.14a
      +FUJITSU Fibre Channel based on SATA Disks

    You can find the files in S3-ownCloud\Shared\owncloud\support\customer-tickets-history\SQLite\

    @jancborchardt @PVince81

  22. cdamken commented on May 20, 2014

    @cdamken
    Contributor

    Additionally: SQLite Version 3.7.13

  23. cdamken commented on May 28, 2014

    @cdamken
    Contributor

    I will close this issue taking in consideration: #6457

  24. macmacy commented on Jul 17, 2014

    @macmacy

    FYI: I have "Database is locked" error very frequently - see here #9701.
    In short: it is enough to mount external storage with 500000 files and you have this error very often.

  25. PVince81 commented on Jul 17, 2014

    @PVince81
    Contributor

    I think for that many files you should rather switch to MySQL or PostgreSQL.
    SQLite will only slow you down for that amount of data.

  26. fleish commented on Aug 8, 2014

    @fleish

    I agree and wish I had gone with mysql from the start vs. having to now convert later. I'd actually prefer that mysql was the default DB choice of owncloud to avoid users having this problem and then having to migrate later.

  27. djtm commented on Sep 9, 2014

    @djtm

    Not sure if this helps for you, but in my case a VACUUM; did the trick. The timeouts disappeared. Not sure if owncloud does this automatically already? I guess it should at least once a week or so.
    I've also noticed that auto vaccum is disabled by default. Maybe that would also help.

  28. locked as resolved and limited conversation to collaborators on Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions