WL#1242: Kill connections with disconnected clients

Affects: Server-7.0   —   Status: Un-Assigned   —   Priority: Low

Currently, while executing very long SELECT query MySQL does not kill it even if
client has already disconnected, (unless query was sending the rows in such case)

One would want queries to be killed on connections closed especially in Web
applications where one often does "Stop"-"Reload" if page does not load fast enough.

Current behavior is especially error prone as testing on "select * from tbl"
type queries one would think the queries are killed on client disconnect.

Query example which does not gets killed on client disconnect: 

select benchmark(10000000000,"1+1")

Implementation ideas:
   This is something what we shall implement on server, to handle all types of
disconnects.  This can be possibly implemented using SQL_TIMEOUT infrastructure
- one could set an alarm to happen periodically (configured interval) which
would check socket status and kill connection if it is disconnected already.

Having this behavior as optional would avoid even minor performance hit.

Note added by Trudy Pelzer on 2005-10-05:
This task suggests SQL_TIMEOUT to implement the feature.
WL#2814 "Query timeouts (SQL_TIMEOUT option)" also 
suggests the use of SQL_TIMEOUT. So we need to be aware
of a possible conflict if both tasks are implemented.
Suggestion from Brian Aker and Robin Schumacher:
MySQL will amend the mysql client program so that,
when a user issues a CTRL-C keyboard command while 
in the mysql client program, a KILL is issued for 
any query/proc/etc. currently executing in the client 

The Task
Currently, under both Linux and Windows, one can stop the 
mysql client program with CTRL-C. The task is:
- when a user stops the mysql client with control-C, send a 
KILL instruction to the mysqld server.