Mysql – Processes dissappear from processlist (MariaDB)

mariadbmariadb-10.1MySQL

In my application I need to monitor list of process ids for some database user, so I execute SHOW PROCESSLIST command to get information.
The problem is that sometimes some Id dissapears from command output but it comes back on next execution. For me it seems like a bug, what cause this strange behaviour?

Example:

1934,1935,1936,1937,1938
1934,1935,1936,1937,1938
1934,1935,1936,1937,1938
1934,1935,1936,1938
1934,1935,1936,1937,1938

Version:

MariaDB [db_w1]> select @@version;
+-----------------+
| @@version       |
+-----------------+
| 10.1.24-MariaDB |
+-----------------+
1 row in set (0.00 sec)

Best Answer

Processes, in the MySQL PROCESS LIST, are representations of connections from outside the server. A mysql -h {host} will create a client connection. They are transient in that, if a client disconnects, the server process no longer exists.

As such a process showing in a process list can no longer be there on subsequent access if the connection was disconnected from the client.