Repository navigation
Conversation
|
Part of #10566 Seems we have a "tabs vs spaces" situation 😉 |
|
To retest:
|
|
@DeepDiver1975 set to 8.1 CC @icewind1991 |
|
🙈 |
The database execute function returns the number of affected items if it is a data manipulation statement.
|
The problem now is that the cursors, which do data manipulation, are not closed. That should be done in executeAudited() function, with a check if the call to |
Classes / Objects: http://php.net/manual/de/internals2.opcodes.instanceof.php |
|
Related ? #13803 |
|
The problem in core is that there are 3-4 different ways of doing queries. And one of them doesn't support closing cursors. I think we wanted to move away from |
|
@nickvergessen partly related. The end goal is the close cursors everywhere as per #10566 |
|
The intendation is always a bit off (seems to be one space). What is the state of this? |
|
8.2 |
|
@dragotin @DeepDiver1975 Revive or close? Problems seems to be fixed now. |
|
@DeepDiver1975 @cmonteroluque Move to 9.0 because it is not really ready for review. |
|
@dragotin FYI |
|
@dragotin @PVince81 @DeepDiver1975 Still valid? |
|
I have no idea if still valid or not but I would assume so. The problem here is not a concrete bug that is fixed or not. Every closeCursor() in this patch releases resources of the underlying database drivers and unlocks tables that are otherwise locked for a parallel request (IIRC). It turned out that closing these cursors helped, but that is hard to proof as it does not play a role under not so loaded conditions as there is less concurrency (down to no concurrency on devs average development system, which is the source of the problem). @DeepDiver1975, @nickvergessen and me came up with this patch during debugging of db lock race-conditions. If you do not wanna use it, drop it. However, I'd ask the database specialist to take it more as an suggestion rather than a concrete PR as probably more closeCursor()-calls could/should be added. |
Lately we tried to always close cursors for new connections that are opened. I guess we simply need to clean things up here. |
|
Yes, it might very well be that this is handled differently/elsewhere or so. |
|
I would like to close this as we don't have specific issues here currently. |
|
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. |
I'd recommend to add the call to closeCursor() on every sql statement object that is not longer used. I took some time to dig through the sources of doctrine and pdo and the sqlite implementation in particular and it turns out that the sqlite3_finalize() function, that frees the database statement, is only called in the destructor (for the C++ implementation). I don't know when that is called by the PHP engine, but obviously that can be done any time later.
As especially SQLite has a very interesting locking method it can easily happen that a writing operation on a table (INSERT, UPDATE) keeps an lock also for reads as long as the writing operation statement was not closed. The subsequent read operations easily can time out or see a lock because of that.
Apart from that, I think it would be good to set a busy handler timeout explicitely:
$PDO->setAttribute( PDO::ATTR_TIMEOUT, 5 /* Timeout in seconds */ );
but I am not sure where to set that.
This submit request is just one step, I think the closeCursor() functions should be added wherever database interaction happens.
Note: This is not a SQLite only problem, it's just pretty visible there.