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

map a linux pid (child pid) to a connection id shown in the output of SHOW PROCESSLIST

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1.8
    • OTHER
    • None
    • 10.1.6-1, 10.1.6-2, 10.1.8-1, 10.1.8-2

    Description

      We have have a multi-threaded program with multiple connections to the database. While this program is running, we often get a single child process (pid) that just hangs. This particular child process consumes 100% of any given CPU. We are trying to troubleshoot this and trying to determine which child pid maps to the SHOW PROCESSLIST Id.

      With that in mind, we would like to know if there is a way to map a linux child pid that's associated with the linux parent pid (ppid) of the mysqld process to the Id shown in the output of SHOW PROCESSLIST.

      Attachments

        Issue Links

          Activity

            jb-boin Jean Weisbuch added a comment -

            These UDFs seems interesting, especially the one to set the cgroup (if it could be used to limit resources per user/db, it would be really useful on a shared hosting environment for example).

            It would be ideal to be able to add informations such as "CPU Time" or "Memory usage" of the process corresponding to the thread directly on I_S.PROCESSLIST which would be better than having to execute an external command to retrieve informations from "/proc" or use "ps".

            jb-boin Jean Weisbuch added a comment - These UDFs seems interesting, especially the one to set the cgroup (if it could be used to limit resources per user/db, it would be really useful on a shared hosting environment for example). It would be ideal to be able to add informations such as "CPU Time" or "Memory usage" of the process corresponding to the thread directly on I_S.PROCESSLIST which would be better than having to execute an external command to retrieve informations from "/proc" or use "ps".

            I found no way to see ID returned by gettid() (actually syscall()) in output of ps command (its TID for MariaDB threads is equal to PID) but the number clearly belong to the same numeration no doubts (found in experimenting)

            getpid() works and allow to find the victim in the ps output.

            sanja Oleksandr Byelkin added a comment - I found no way to see ID returned by gettid() (actually syscall()) in output of ps command (its TID for MariaDB threads is equal to PID) but the number clearly belong to the same numeration no doubts (found in experimenting) getpid() works and allow to find the victim in the ps output.

            revision-id: 6811945eaf6a6e979d92739399b084bf4e00ae2d (mariadb-10.1.6-12-g6811945e)
            parent(s): 86a3613d4e981c341e38291c9eeec5dc9f836fae
            committer: Oleksandr Byelkin
            timestamp: 2015-08-12 23:09:48 +0200
            message:

            MDEV-6756: map a linux pid (child pid) to a connection id shown in the output of SHOW PROCESSLIST

            Added tid & pid for Linux.

            sanja Oleksandr Byelkin added a comment - revision-id: 6811945eaf6a6e979d92739399b084bf4e00ae2d (mariadb-10.1.6-12-g6811945e) parent(s): 86a3613d4e981c341e38291c9eeec5dc9f836fae committer: Oleksandr Byelkin timestamp: 2015-08-12 23:09:48 +0200 message: MDEV-6756 : map a linux pid (child pid) to a connection id shown in the output of SHOW PROCESSLIST Added tid & pid for Linux. —

            revision-id: 7f7cbb132fa0a40687e4b25a9c9e163c93ec6d15 (mariadb-10.1.6-12-g7f7cbb1)
            parent(s): 86a3613d4e981c341e38291c9eeec5dc9f836fae
            committer: Oleksandr Byelkin
            timestamp: 2015-09-14 12:47:57 +0200
            message:

            MDEV-6756: map a linux pid (child pid) to a connection id shown in the output of SHOW PROCESSLIST

            Added tid (thread ID) for system where it is present.

            ps -eL -o tid,pid,command

            shows the thread on Linux

            sanja Oleksandr Byelkin added a comment - revision-id: 7f7cbb132fa0a40687e4b25a9c9e163c93ec6d15 (mariadb-10.1.6-12-g7f7cbb1) parent(s): 86a3613d4e981c341e38291c9eeec5dc9f836fae committer: Oleksandr Byelkin timestamp: 2015-09-14 12:47:57 +0200 message: MDEV-6756 : map a linux pid (child pid) to a connection id shown in the output of SHOW PROCESSLIST Added tid (thread ID) for system where it is present. ps -eL -o tid,pid,command shows the thread on Linux —

            revision-id: a1f31cfa8d0f04cb166813786f7854db3dbcf715 (mariadb-10.1.6-12-ga1f31cf)
            parent(s): 86a3613d4e981c341e38291c9eeec5dc9f836fae
            committer: Oleksandr Byelkin
            timestamp: 2015-09-15 21:50:28 +0200
            message:

            MDEV-6756: map a linux pid (child pid) to a connection id shown in the output of SHOW PROCESSLIST

            Added tid (thread ID) for system where it is present.

            ps -eL -o tid,pid,command

            shows the thread on Linux

            sanja Oleksandr Byelkin added a comment - revision-id: a1f31cfa8d0f04cb166813786f7854db3dbcf715 (mariadb-10.1.6-12-ga1f31cf) parent(s): 86a3613d4e981c341e38291c9eeec5dc9f836fae committer: Oleksandr Byelkin timestamp: 2015-09-15 21:50:28 +0200 message: MDEV-6756 : map a linux pid (child pid) to a connection id shown in the output of SHOW PROCESSLIST Added tid (thread ID) for system where it is present. ps -eL -o tid,pid,command shows the thread on Linux —

            People

              sanja Oleksandr Byelkin
              hhiggs Harry Higgs
              Votes:
              4 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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