----------------------------------------------------------------------- WORKLOG TASK -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- TASK...........: table lock wait timeouts CREATION DATE..: Wed, 13 Apr 2011, 17:09 SUPERVISOR.....: IMPLEMENTOR....: COPIES TO......: CATEGORY.......: Server-RawIdeaBin TASK ID........: 197 (http://askmonty.org/worklog/?tid=197) VERSION........: WorkLog-4.0 STATUS.........: Un-Assigned PRIORITY.......: 60 WORKED HOURS...: 0 ESTIMATE.......: 0 (hours remain) ORIG. ESTIMATE.: 0 PROGRESS NOTES: DESCRIPTION: MySQL has table_lock_wait_timeout but that doesn't do anything. For some apps it would help to timeout sessions blocked on a table lock. For example, when ALTER TABLE runs it implicitly gets an X lock on the table cache entry. Queries that follow are blocked until it finishes. The client-side read timeout might expire and disconnect the client but the server-side thread will continue blocking and the server can fill with blocked sessions. Right now the stack when the client blocks is open_tables -> open_table -> wait_for_condition. I implemented a demo for this by: 1) use pthread_cond_timedwait in wait_for_condition 2) check for timeout expiration in open_tables and error out Without the change in 2) the session will loop within open_tables on calls to open_table. ESTIMATED WORK TIME ESTIMATED COMPLETION DATE ----------------------------------------------------------------------- WorkLog (v4.0.0)