Bug #99204 performance_schema threads table PROCESSLIST_INFO incorrect behaviour
Submitted: 7 Apr 2020 20:52 Modified: 8 Apr 2020 5:41
Reporter: Marcelo Altmann Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:5.7.29, 8.0.19 OS:Any
Assigned to: CPU Architecture:Any

[7 Apr 2020 20:52] Marcelo Altmann
Description:
According to the documentation PROCESSLIST_INFO shows the statements the threads is executing, if it's not executing anything or has finished it should show null:

https://dev.mysql.com/doc/refman/8.0/en/threads-table.html

PROCESSLIST_INFO

The statement the thread is executing, or NULL if it is not executing any statement. The statement might be the one sent to the server, or an innermost statement if the statement executes other statements. For example, if a CALL statement executes a stored procedure that is executing a SELECT statement, the PROCESSLIST_INFO value shows the SELECT statement.

As shown below, thread has already finished to execute (PROCESSLIST_COMMAND: Sleep), but it still shows the PROCESSLIST_INFO:

*************************** 28. row ***************************
          THREAD_ID: 31
               NAME: thread/sql/one_connection
               TYPE: FOREGROUND
     PROCESSLIST_ID: 5
   PROCESSLIST_USER: root
   PROCESSLIST_HOST: localhost
     PROCESSLIST_DB: NULL
PROCESSLIST_COMMAND: Sleep
   PROCESSLIST_TIME: 4
  PROCESSLIST_STATE: NULL
   PROCESSLIST_INFO: SELECT 1
   PARENT_THREAD_ID: NULL
               ROLE: NULL
       INSTRUMENTED: YES
            HISTORY: YES
    CONNECTION_TYPE: SSL/TLS
       THREAD_OS_ID: 35544

How to repeat:
Open a connection and execute a query
Open a second connection and query threads table:
SELECT * from performance_schema.threads\G

Suggested fix:
Either the documentation is incomplete or the server behavior is wrong.
[8 Apr 2020 5:41] MySQL Verification Team
Hello Marcelo,

Thank you for the report and feedback.
Verified as described.

Thanks,
Umesh
[8 Apr 2020 12:15] Marcelo Altmann
(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Attachment: bug99204_57_and_80.patch (application/octet-stream, text), 432 bytes.