MySQL server process hangs in "sending data" state

This took me almost an hour to figure out. Using MySQL server v5.0.51a (to be exact, the package version was "5.0.51a-24+lenny2~bpo40+1-log" on a Debian Etch server and using the backports repository) I tried to create a new table from the results of a query (you know: CREATE TABLE ... SELECT ...). I watched the MySQL process state as it changed from "copying tmp table" to "sorting" and then to "sending data". However during the latter I did not see any significant CPU or I/O usage and the SQL statement never finished. I waited a very long time and nothing.

I used phpmyadmin and I thought maybe the problem lies with that. So I started the mysql client on the server and executed the statement from the command line too. And the error message came up: not enough disk space. Smile It turned out that the partition (on which the database was stored) ran out of free space. Unfortunately MySQL does not stop the process/command with an error, when it hits the "disk is full" event during the I/O. Instead it seems to wait indefinitely. I wonder what is it waiting for? Maybe a miracle? Smile This is definitely a bug and you should know about it in case you experience the same symptoms.