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

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Fix Version/s: 10.1.8
    • Component/s: OTHER
    • Labels:
      None
    • Sprint:
      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.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            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".

            Show
            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".
            Hide
            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.

            Show
            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.
            Hide
            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.

            Show
            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. —
            Hide
            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

            Show
            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 —
            Hide
            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

            Show
            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

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 30 minutes
                  30m

                    Agile