This is a very intermittent problem which appears to manifest in two ways and to date from when C4::Context->dbh stopped using ping way back in commit 4ae3665ad8afb5d283d989c4622a91690e1c4f8a Stale dbh remains active. This was seen on clients which are up for 24 hours, when after 12hours or so of only sending status requests (which do require db access) a real request comes in the database handle which should be refreshed is not but is treated as valid. e.g. a valid patron is entered but the sip server returns it as invalid (the undef returned from the invalid dbh is indistinguishable from returning 0 rows) - In practice I've circumvented this by getting the sepserver to restart all persistent connections at e.g. 6 or 7 am so that the reconnecting devices get a fresh db connection. Another possible solution may be to force a dbh connect in processing a status request. Second manifestation is in authentication I found that intermittently a login was being rejected with 'maintenence' or 'failure' this being the status return from check_api_auth unjustified in both cases. This may be a single occurence, a cluster of occurences and seems to then correct itself I've installed a kludge that does a ping using the dbh returned by context before calling check_api_auth, so far so good, but the intermittent nature of the prob means that I need to continue monitoring
Created attachment 53071 [details] [review] Bug 15419 SIP: call auth() subs with timeout, and refresh dbh if need be
To test: * Start SIP server * Make a request * Stop mysql daemon; start mysql daemon * Make another SIP request - it should not timeout on stale handle
Created attachment 55273 [details] [review] Bug 15419 SIP: handle requests with timeout, and refresh dbh if need be
(In reply to Srdjan Jankovic from comment #3) > Created attachment 55273 [details] [review] [review] > Bug 15419 SIP: handle requests with timeout, and refresh dbh if need be Do we need to timeout. DBI provides the ping method to test this
If the question is "should we ping instead of timing out" I think pinging every time is too harsh on the database. But I'd like to hear opinions.
Created attachment 57871 [details] [review] Bug 15419 SIP: handle requests with timeout, and refresh dbh if need be Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Is this still valid for new versions? I'd expect this to be fixed by bug 14778.
Yes, that should be the case.
(In reply to Srdjan Jankovic from comment #8) > Yes, that should be the case. So are you saying this bug should be closed, or it is still needed?
Closed. Will reopen if needed.