Skip to content

[WIP] adding configuration option for sqlite timeout - refs #12429 - #13615

Closed
DeepDiver1975 wants to merge 1 commit into
masterfrom
sqlite-busy-timeout
Closed

DeepDiver1975 wants to merge 1 commit into
masterfrom
sqlite-busy-timeout

Conversation

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@PVince81 this is how we could configure sqlite timeout

Code segment from PHP where busyTimeout is applied - https://github.com/php/php-src/blob/master/ext/pdo_sqlite/sqlite_driver.c#L303

@DeepDiver1975 DeepDiver1975 added this to the 8.1-next milestone Jan 22, 2015
@DeepDiver1975

Copy link
Copy Markdown
Contributor Author

refs #12429

@karlitschek

Copy link
Copy Markdown
Contributor

makes sense 👍

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: No new issues

@ghost

ghost commented Jan 22, 2015

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/7757/

Build result: FAILURE

[...truncated 13 lines...] > git config --local --remove-section credential # timeout=10 > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10 > git config remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10 > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.gitusing GIT_SSH to set credentials using .gitcredentials to set credentials > git config --local credential.helper store --file=/tmp/git8709658071531764995.credentials # timeout=10 > git -c core.askpass=true fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git config --local --remove-section credential # timeout=10 > git rev-parse refs/remotes/origin/pr/13615/merge^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/pr/13615/merge^{commit} # timeout=10Checking out Revision 0c96afdcca6ca6716216b06d3457254a5c4c8893 (refs/remotes/origin/pr/13615/merge) > git config core.sparsecheckout # timeout=10 > git checkout -f 0c96afdcca6ca6716216b06d3457254a5c4c8893First time build. Skipping changelog. > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » SLAVEpull-request-analyser-ng-simple » SLAVE completed with result FAILURESetting status of 011f1ff to FAILURE with url https://ci.owncloud.org/job/pull-request-analyser-ng-simple/7757/ and message: Merged build finished.
💣 Test FAILed. 💣

@LukasReschke

Copy link
Copy Markdown
Contributor

Falling apart:

5:07:22 There were 3 failures:
15:07:22 
15:07:22 1) Test_DB::testUpdateAffectedRowsSame
15:07:22 Failed asserting that 0 is identical to 1.
15:07:22 
15:07:22 /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/tests/lib/db.php:252
15:07:22 
15:07:22 2) Test_DB::testUpdateAffectedRowsMultiple
15:07:22 Failed asserting that 1 is identical to 2.
15:07:22 
15:07:22 /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/tests/lib/db.php:263
15:07:22 
15:07:22 3) Test_OC_OCS_Privatedata::testSetSameValue
15:07:22 Failed asserting that 2 matches expected 1.
15:07:22 
15:07:22 /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/tests/lib/ocs/privatedata.php:161
15:07:22 /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/tests/lib/ocs/privatedata.php:97

@DeepDiver1975

Copy link
Copy Markdown
Contributor Author

Falling apart:

tired

@LukasReschke

Copy link
Copy Markdown
Contributor

73upl4

@guruz

guruz commented Jan 23, 2015

Copy link
Copy Markdown
Contributor

Will this also go into 7.x?

@dragotin and me are a bit worried about the paralleism that the 1.8 client brings..
We could announce that we only support servers with MySQL for the moment or so.

@DeepDiver1975

Copy link
Copy Markdown
Contributor Author

Will this also go into 7.x?

this will even not go into 8.0 - milestone is on 8.1

@guruz

guruz commented Jan 23, 2015

Copy link
Copy Markdown
Contributor

sigh
Related owncloud/client#2743

@DeepDiver1975

Copy link
Copy Markdown
Contributor Author

@guruz we even don't know if it really helps to tweak around on the timeout. This has to be properly tested.

@guruz

guruz commented Jan 29, 2015

Copy link
Copy Markdown
Contributor

Why I think the busy handler needs to be in 7.0, 8.0 and 8.1

owncloud_suggestions

@PVince81

Copy link
Copy Markdown
Contributor

I merged this with master (which contains the other sqlite fix for the FS part) and as far as I understand I don't need to add any settings, and the timeout would default to 60 second.

And yet the "lastlogin" update from the concurrent auth-ing PROPFINDs from #13705 still locks:

{"reqId":"aed15bdbfe760abde09535ee60345647","remoteAddr":"192.168.1.2","app":"remote","message":"An exception occurred while executing 'UPDATE \"oc_preferences\" SET \"configvalue\" = ? WHERE \"userid\" = ? AND \"appid\" = ? AND \"configkey\" = ? ' with params [1417180669, \"root\", \"login\", \"lastLogin\"]:\n\nSQLSTATE[HY000]: General error: 5 database is locked","level":4,"time":"2014-11-28T13:17:49+00:00"}
{"reqId":"cd04246444522861fa21cdeba9b7a0f7","remoteAddr":"192.168.1.2","app":"remote","message":"An exception occurred while executing 'UPDATE \"oc_preferences\" SET \"configvalue\" = ? WHERE \"userid\" = ? AND \"appid\" = ? AND \"configkey\" = ? ' with params [1417180669, \"root\", \"login\", \"lastLogin\"]:\n\nSQLSTATE[HY000]: General error: 5 database is locked","level":4,"time":"2014-11-28T13:17:49+00:00"}
{"reqId":"ca8bbbcb5052a9c47d5c19a49f3a5068","remoteAddr":"192.168.1.2","app":"remote","message":"An exception occurred while executing 'UPDATE \"oc_preferences\" SET \"configvalue\" = ? WHERE \"userid\" = ? AND \"appid\" = ? AND \"configkey\" = ? ' with params [1417180669, \"root\", \"login\", \"lastLogin\"]:\n\nSQLSTATE[HY000]: General error: 5 database is locked","level":4,"time":"2014-11-28T13:17:49+00:00"}
{"reqId":"e2dec4ec401c1833fb91bd1859f8b384","remoteAddr":"192.168.1.2","app":"remote","message":"An exception occurred while executing 'UPDATE \"oc_preferences\" SET \"configvalue\" = ? WHERE \"userid\" = ? AND \"appid\" = ? AND \"configkey\" = ? ' with params [1417180669, \"root\", \"login\", \"lastLogin\"]:\n\nSQLSTATE[HY000]: General error: 5 database is locked","level":4,"time":"2014-11-28T13:17:49+00:00"}

Either the timeout value isn't passed properly or SQLite is just being mean.

@PVince81

Copy link
Copy Markdown
Contributor

Am debugging this now. Something suspicious with "driverOptions".

@PVince81

Copy link
Copy Markdown
Contributor

Basically PDO::ATTR_TIMEOUT evaluates to 2. I'd expect this to be a string id instead.
So we have this:
$connectionParams['driverOptions'][2] = 60

@PVince81

Copy link
Copy Markdown
Contributor

Ok turns out that PDO attributes are indeed integers.

While debugging I have the feeling that we might not be passing the options properly to the PDO driver (still trying to find out where it is actually created through debugging), especially that we pass a connection wrapper which doesn't seem to do anything with these options.

@PVince81

Copy link
Copy Markdown
Contributor

I debugged deep and saw that the parameter was passed properly to the PDO class. And yet still seems to be ignored.

@PVince81

Copy link
Copy Markdown
Contributor

Tried using PRAGMA busy_timeout 6000 (without @DeepDiver1975's option) and also tried querying PRAGMA busy_timeout and it did return the correct value.

This means that the setting is indeed set properly but SQLite refuses to behave.

@PVince81

Copy link
Copy Markdown
Contributor

I got news: if SQLite seems to ignore the timeout and throw "Database is locked" directly, first step is to check for any unclosed "SELECT" that is directly followed by an "UPDATE" on the same table.
We seem to do that often, see here: https://github.com/owncloud/core/blob/master/lib/private/allconfig.php#L180

@guruz

guruz commented Jan 29, 2015

Copy link
Copy Markdown
Contributor

Developer of the day: @PVince81

@PVince81

Copy link
Copy Markdown
Contributor

Also thanks @guruz for the psychological support 😉

@guruz

guruz commented Jan 29, 2015

Copy link
Copy Markdown
Contributor

My only goal was to prove @DeepDiver1975 wrong. But now you found so many related bugs :D gooood!

@LukasReschke LukasReschke changed the title adding configuration option for sqlite timeout - refs #12429 [WIP] adding configuration option for sqlite timeout - refs #12429 Feb 24, 2015
@DeepDiver1975 DeepDiver1975 modified the milestones: 8.2-next, 8.1-current Mar 4, 2015
@ghost

ghost commented Apr 30, 2015

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/12048/
💣 Test FAILed. 💣

nooo432

@DeepDiver1975
DeepDiver1975 deleted the sqlite-busy-timeout branch July 3, 2015 13:44
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants