You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make sure cursors are closed everywhere / Database is locked #10566
In some cases when prepared statements are used, if the cursors aren't closed explicitly, there is a higher risk to run into "Database is locked" issues on SQLite (and maybe max cursors reached on Oracle). We cannot rely on garbage collection to free these resources.
We should go through the core code and find the prepared statements that aren't closed explicitly.
The most likely to cause trouble is ones that might be called repeatedly or the ones defined as class attributes instead of local variables.
If you do not fetch all of the data in a result set before issuing your next call to PDO::query(), your call may fail. Call PDOStatement::closeCursor() to release the database resources associated with the PDOStatement object before issuing your next call to PDO::query().
There will be a read lock on the database whenever there is an open cursor. If the database was unlocked prior to this instruction then a read lock is acquired as part of this instruction. A read lock allows other processes to read the database but prohibits any other process from modifying the database. The read lock is released when all cursors are closed. If this instruction attempts to get a read lock but fails, the script terminates with an SQLITE_BUSY error code.
So, when a SELECT query is executed, but the result set is still open when a modifying SQL statement is executed on the same table we will get the DATABASE LOCKED error.
Side-note: I'm now struggling with Oracle problems now after adding closeCursor() instructions in my code. Will report later when I found a solution...
Not sure, but on my test machine I had to increase the number of cursors because I was getting "Max cursors reached" when running all unit tests on Oracle.
The issue I'm having now is different, see #7539 (comment)
I hope to be able to fix it without having to remove the explicit "closeCursor()".
Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.
Activity
butonic commentedon Aug 21, 2014
a hint: http://php.net/manual/de/pdo.query.php
butonic commentedon Aug 21, 2014
and from http://www.sqlite.org/opcode.html#OpenRead
So, when a
SELECTquery is executed, but the result set is still open when a modifying SQL statement is executed on the same table we will get theDATABASE LOCKEDerror.PVince81 commentedon Aug 21, 2014
Side-note: I'm now struggling with Oracle problems now after adding
closeCursor()instructions in my code. Will report later when I found a solution...butonic commentedon Aug 21, 2014
did you see http://www.doctrine-project.org/jira/browse/DC-509? it mentions a fix in derflocki/doctrine1@47b926a
quite a dated bug ... I wonder if the fix still applies
butonic commentedon Aug 21, 2014
Now this seems interesting end exactly the kind of crappy hacking needed to get oracle working http://php.net/manual/de/function.oci-free-statement.php#81577 Now investigating if doctrine does free the cursor AND the statement.
PVince81 commentedon Aug 21, 2014
Not sure, but on my test machine I had to increase the number of cursors because I was getting "Max cursors reached" when running all unit tests on Oracle.
The issue I'm having now is different, see #7539 (comment)
I hope to be able to fix it without having to remove the explicit "closeCursor()".
PVince81 commentedon Sep 9, 2014
I don't think we want to risk introducing regressions in OC 7 by adding cursor closing everywhere ?
Should be fine for OC 8
46 remaining items
DeepDiver1975 commentedon Oct 6, 2015
@karlitschek @cmonteroluque
To late in the dev cycle - I suggest to postpone this to 9.0 or even backlog - THX
karlitschek commentedon Oct 6, 2015
yes. too late for proper testing anyways
ownclouders commentedon Jan 13, 2018
Hey, this issue has been closed because the label
status/STALEis set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.(This is an automated comment from GitMate.io.)
PVince81 commentedon Jan 15, 2018
Haven't heard of such issues any more, leaving closed.
lock commentedon Jul 31, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.