Bug #33342 Backup command leaves zombie thread
Submitted: 18 Dec 2007 19:50 Modified: 18 Dec 2007 20:52
Reporter: Chuck Bell Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0 OS:Any
Assigned to: CPU Architecture:Any

[18 Dec 2007 19:50] Chuck Bell
Description:
When a backup or restore operation runs, the thread structure (THD *) is not removed from the list of processes. Thus, when the operation is complete the process list shows a zombie process.

This was discovered while diagnosing BUG#32970.

The zombie thread doesn't seem to cause any problems -- just incorrectly reports a process still running that isn't. Interestingly, it is killed (removed) on subsequent backup operations but they too won't die and leave a (NULL, NULL) in the state, info columns of SHOW PROCESSLIST.

How to repeat:
* Start the server.
* Start and connect 2 clients.
* In client 1, issue the statements:

SET GLOBAL debug="d,backup_debug:d,backup";
# Note: any valid breakpoint for backup will do
SELECT get_lock("locking_thread_added", 100); 

* In client 2, issue the statement:

#Note: any database will do
BACKUP DATABASE bup_ddl_blocker TO 'b.bak';

* In client 1, issue the query:

# Show the processlist
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST \G

Notice the output for the backup command:

     ID: 1
   USER: root
   HOST: localhost:50473
     DB: test
COMMAND: Query
   TIME: 14
  STATE: debug_sync_point: locking_thread_added
   INFO: backup database test to 'b`.bak'

# release the breakpoint
SELECT release_lock("locking_thread_added");

# Show the processlist - BACKUP command should not be there
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST \G

Notice the output:

     ID: 1
   USER: root
   HOST: localhost:50473
     DB: test
COMMAND: Sleep
   TIME: 41
  STATE: NULL
   INFO: NULL
2 rows in set (0.01 sec)

Repeated calls to show the processlist from either client result in the same output. 

Where did he go?

Suggested fix:
Examine the code dealing with the THD * structure for the backup operation and correct any abnormal or missing method calls or attribute state changes.
[18 Dec 2007 20:52] Chuck Bell
Sorry, I just discovered this is normal behavior. Please disregard. Nothing is wrong. The NULL, NULL process is the normal thread handler for a client connection. Silly developer... ;)