Page MenuHomePhabricator

Log the query that caused a lock timeout
Open, LowPublic


I suspect this is not possible but no harm in trying: it would be great if the error log about some DB query timing out due to a lock could automatically include what was the other query that caused the lock. DB error logs contain a bunch of information about the failing query (stack trace, sanitized query text) but in the case of lock timeouts, more often than not it's the locking query and not the locked query that's problematic, and there is no information about that at all, so identifying it tends to take a considerable amount of time.

Maybe something like SHOW ENGINE INNODB STATUS or innodb_print_all_deadlocks could be used to get locking query info into the error logs?

See also: T195792: Create Mediawiki DB abstraction for individual query timeouts

Event Timeline

Tgr created this task.Jul 3 2018, 7:25 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 3 2018, 7:25 PM

I don't think "interactive logging" would be easy to implement- the query knows if it cannot continue or if it reaches a timeout, but it is not notified of who handles the row locks. There could be, however, queries of heuristics causes with processlist or some of the suggestions mentioned.

However, on T195578 there could be global monitoring that could be useful (but I am not sure if it is enabled).

jcrespo moved this task from Triage to Meta/Epic on the DBA board.Jul 13 2018, 8:16 AM
Krinkle triaged this task as Low priority.Jul 23 2019, 5:46 PM
Restricted Application added a project: Core Platform Team. · View Herald TranscriptJul 23 2019, 5:46 PM