Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34482

own threads from events are not visible for user

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6.18, 10.11.8
    • 10.5, 10.6, 10.11, 11.4
    • Information Schema
    • None
    • Server version: 10.11.8-MariaDB FreeBSD Ports

    Description

      User without PROCESS privilege should be able to see own threads in `information_schema.processlist` - but threads created via event scheduler are not visible. They can be killed by user (but the user cannot find their id). This behavior is different from described in docs:
      https://mariadb.com/kb/en/show-processlist/

      If you have the PROCESS privilege, you can see all threads. Otherwise, you can see only your own threads (that is, threads associated with the MariaDB account that you are using).

      To replicate

      As root

      mysql -u root -p 
       
      root@localhost [(none)]> use test;
      Database changed
       
      root@localhost [test]> CREATE USER `mg`@`localhost`;
      Query OK, 0 rows affected (0.133 sec)
       
      root@localhost [test]> set password for `mg`@`localhost` = password('qqq');
      Query OK, 0 rows affected (0.032 sec)
       
      root@localhost [test]> GRANT ALL PRIVILEGES ON `test`.* TO `mg`@`localhost`;
      Query OK, 0 rows affected (0.053 sec)
       
      root@localhost [test]> flush privileges;
      Query OK, 0 rows affected (0.052 sec)
       
      root@localhost [test]> SET GLOBAL event_scheduler=ON;
      

      as user:

      mg@localhost [test]> delimiter ;;                                                                                                           
      mg@localhost [test]> CREATE PROCEDURE mgtest()                        
          -> BEGIN                                                                                                                                
          ->     DO SLEEP(59);                                                                                                                    
          -> END;;                                                                                                                                
      Query OK, 0 rows affected (0.116 sec)       
       
      mg@localhost [test]> CREATE EVENT mgtestevent                                                                                               
          ->     ON SCHEDULE                                                                                                                      
          ->         EVERY 1 MINUTE                                                                                                               
          ->         STARTS CURRENT_TIMESTAMP + INTERVAL 10 SECOND                                                                                
          ->         ENDS CURRENT_TIMESTAMP + INTERVAL 1 HOUR                                                                                     
          ->     ENABLE                                                                                                                           
          ->     DO                                                                                                                               
          ->       CALL mgtest();                                           
          ->       ;;                                                       
      Query OK, 0 rows affected (0.011 sec)  
      

      As root:

      root@localhost [test]> show processlist;
      +---------+-----------------+-----------+------+---------+------+-----------------------------+------------------+----------+
      | Id      | User            | Host      | db   | Command | Time | State                       | Info             | Progress |
      +---------+-----------------+-----------+------+---------+------+-----------------------------+------------------+----------+
      | 1904702 | root            | localhost | test | Query   |    0 | starting                    | show processlist |    0.000 |
      | 1904754 | mg              | localhost | test | Sleep   |   23 |                             | NULL             |    0.000 |
      | 1904792 | event_scheduler | localhost | NULL | Daemon  |  112 | Waiting for next activation | NULL             |    0.000 |
      | 1904830 | mg              | localhost | test | Connect |    1 | User sleep                  | DO SLEEP(59)     |    0.000 |
      +---------+-----------------+-----------+------+---------+------+-----------------------------+------------------+----------+
      

      As user:

      mg@localhost [test]> show processlist;
      +---------+------+-----------+------+---------+------+----------+------------------+----------+
      | Id      | User | Host      | db   | Command | Time | State    | Info             | Progress |
      +---------+------+-----------+------+---------+------+----------+------------------+----------+
      | 1904754 | mg   | localhost | test | Query   |    0 | starting | show processlist |    0.000 |
      +---------+------+-----------+------+---------+------+----------+------------------+----------+
      1 row in set (0.000 sec)
       
      mg@localhost [test]> kill 1904830;
      Query OK, 0 rows affected (0.000 sec)
       
      mg@localhost [test]> kill 1904830;
      ERROR 1094 (HY000): Unknown thread id: 1904830
      

      Attachments

        Activity

          People

            wlad Vladislav Vaintroub
            marcin.gryszkalis Marcin Gryszkalis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.