← Back to team overview

maria-developers team mailing list archive

WL#196 New (by Mdcallag): add is_connection_alive for server-side checks to find disconnected clients

 

-----------------------------------------------------------------------
                              WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: add is_connection_alive for server-side checks to find disconnected
		clients
CREATION DATE..: Fri, 08 Apr 2011, 14:06
SUPERVISOR.....: 
IMPLEMENTOR....: 
COPIES TO......: 
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 196 (http://askmonty.org/worklog/?tid=196)
VERSION........: WorkLog-4.0
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 0
ESTIMATE.......: 0 (hours remain)
ORIG. ESTIMATE.: 0

PROGRESS NOTES:



DESCRIPTION:

There are a few places in the server where the thread for a user connection will 
wait. With upcoming features in the FB patch there will be more places. I don't 
want a thread to continue waiting after the client has disconnected. Is it 
possible to check whether the client has disconnected without reading/writing 
more than 0 bytes from the socket? Assuming the check is is_connection_alive(), 
it can return TRUE when the client has disconnected (but not all of the time). 
But it must not return FALSE when the client has not disconnected.

The check does not have to be cheap. It can require a system call as it won't be 
made frequently. For example, assume that a row lock wait is implemented as a 
sequent of timed pthread condition variable waits (1 second each). At the end of 
each 1 second timeout there can be a check for whether the connection was killed 
and a check for whether the client has disconnected.

Disconnected clients on the server-side can be a serious problem for high 
throughput servers. The worst case is when the client starts a long-running and 
blocking query (external sort) that won't return a row for a long time and thus 
won't detect the disconnected client for a long time.

I have used tool in the past that join output from netstat with SHOW PROCESSLIST 
to find sockets for disconnected clients. This works but is very expensive.


ESTIMATED WORK TIME

ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v4.0.0)