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

MariaDB slave 10.2 leaks temporary tables

Details

    Description

      We have 4 slaves using MariaDB 10.2 doing replication from a 10.2 master. Binary log format is MIXED and temporary tables are using MyISAM format. The number of temporary tables on the slave is growing continuously up to the point of exhausting the file descriptor limit of the operating system assigned to the process. After that the only solution is stopping the slave server and starting again.

      This was happening with 10.2.17 on the slaves. We have upgraded to 10.2.18 and the behavior is the same.

      The Slave_open_temp_tables variable counter goes up and is consistent with the number of #sql*.MYD files on the tmpdir.

      mainro [(none)]> SHOW STATUS LIKE 'Slave_open_temp_tables';
      +------------------------+-------+
      | Variable_name          | Value |
      +------------------------+-------+
      | Slave_open_temp_tables | 3665  |
      +------------------------+-------+
      1 row in set (0.00 sec)

      # cd /var/db/tmp ; ls -l *.MYD | wc -l
      3665

      The server does not delete the tmp files from different slave sql threads execution. For example:

      -rw-rw---- 1 mysql mysql      0 Oct  9 16:46 #sql4bb4_4809_ff2c.MYD
      -rw-rw---- 1 mysql mysql   1604 Oct  9 16:46 #sql4bb4_4809_ff42.MYD
      -rw-rw---- 1 mysql mysql     84 Oct  9 16:46 #sql4bb4_4809_ff43.MYD
      -rw-rw---- 1 mysql mysql      0 Oct  9 16:46 #sql4bb4_4809_ff45.MYD
      -rw-rw---- 1 mysql mysql   2912 Oct  9 16:46 #sql4bb4_4809_ff5b.MYD
      -rw-rw---- 1 mysql mysql     84 Oct  9 16:46 #sql4bb4_4809_ff5c.MYD
      -rw-rw---- 1 mysql mysql      0 Oct  9 16:46 #sql4bb4_4809_ff5e.MYD
      -rw-rw---- 1 mysql mysql   5928 Oct  9 16:46 #sql4bb4_4809_ffb1.MYD
      -rw-rw---- 1 mysql mysql     84 Oct  9 16:46 #sql4bb4_4809_ffb2.MYD
      -rw-rw---- 1 mysql mysql      0 Oct  9 16:46 #sql4bb4_4809_ffb4.MYD
      -rw-rw---- 1 mysql mysql      0 Oct  8 17:34 #sql4bb4_77_10488.MYD
      -rw-rw---- 1 mysql mysql      0 Oct  8 17:34 #sql4bb4_77_10489.MYD
      -rw-rw---- 1 mysql mysql     24 Oct  8 17:36 #sql4bb4_77_10866.MYD
      -rw-rw---- 1 mysql mysql      0 Oct  8 17:37 #sql4bb4_77_10a73.MYD
      -rw-rw---- 1 mysql mysql    468 Oct  8 14:07 #sql4bb4_77_10.MYD
      -rw-rw---- 1 mysql mysql      0 Oct  8 17:46 #sql4bb4_77_11ade.MYD
      -rw-rw---- 1 mysql mysql   1468 Oct  8 17:46 #sql4bb4_77_11b1e.MYD
      -rw-rw---- 1 mysql mysql     84 Oct  8 17:46 #sql4bb4_77_11b1f.MYD
      -rw-rw---- 1 mysql mysql      0 Oct  8 17:46 #sql4bb4_77_11b21.MYD
      -rw-rw---- 1 mysql mysql   1352 Oct  8 17:46 #sql4bb4_77_11b35.MYD
      -rw-rw---- 1 mysql mysql     84 Oct  8 17:46 #sql4bb4_77_11b36.MYD

      After stopping the server, also does not remove the files. We have to remove the files manually.

      We have tried changing the variable default_tmp_storage_engine from MyISAM to InnoDB and the counter Slave_open_temp_tables also keeps growing but, of course, we don't see any temp files on tmpdir, but we believe that eventually something will broke inside InnoDB.

      We have been analyzing the binary log and it appears that all explicit create temporary tables are being dropped, either manually by the application, or automatically by the master after session close. Could these stale temporary tables be internal temporary tables that the server is using to resolve some difficult queries?

      Attachments

        Issue Links

          Activity

            gomita Gabriel Gomiz created issue -
            gomita Gabriel Gomiz made changes -
            Field Original Value New Value
            Description We have 4 slaves using MariaDB 10.2 doing replication from a 10.2 master. Binary log format is MIXED and temporary tables are using MyISAM format. The number of temporary tables on the slave is growing continuously up to the point of exhausting the file descriptor limit of the operating system assigned to the process. After that the only solution is stopping the slave server and starting again.

            This was happening with 10.2.17 on the slaves. We have upgraded to 10.2.18 and the behavior is the same.

            The Slave_open_temp_tables variable counter goes up and is consistent with the number of #sql*.MYD files on the tmpdir.

            {{mainro [(none)]> SHOW STATUS LIKE 'Slave_open_temp_tables';
            +------------------------+-------+
            | Variable_name | Value |
            +------------------------+-------+
            | Slave_open_temp_tables | 3665 |
            +------------------------+-------+
            1 row in set (0.00 sec)}}

            {{# cd /var/db/tmp ; ls -l *.MYD | wc -l
            3665}}

            The server does not delete the tmp files from different slave sql threads execution. For example:

            {{
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff2c.MYD
            -rw-rw---- 1 mysql mysql 1604 Oct 9 16:46 #sql4bb4_4809_ff42.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ff43.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff45.MYD
            -rw-rw---- 1 mysql mysql 2912 Oct 9 16:46 #sql4bb4_4809_ff5b.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ff5c.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff5e.MYD
            -rw-rw---- 1 mysql mysql 5928 Oct 9 16:46 #sql4bb4_4809_ffb1.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ffb2.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ffb4.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:34 #sql4bb4_77_10488.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:34 #sql4bb4_77_10489.MYD
            -rw-rw---- 1 mysql mysql 24 Oct 8 17:36 #sql4bb4_77_10866.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:37 #sql4bb4_77_10a73.MYD
            -rw-rw---- 1 mysql mysql 468 Oct 8 14:07 #sql4bb4_77_10.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:46 #sql4bb4_77_11ade.MYD
            -rw-rw---- 1 mysql mysql 1468 Oct 8 17:46 #sql4bb4_77_11b1e.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 8 17:46 #sql4bb4_77_11b1f.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:46 #sql4bb4_77_11b21.MYD
            -rw-rw---- 1 mysql mysql 1352 Oct 8 17:46 #sql4bb4_77_11b35.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 8 17:46 #sql4bb4_77_11b36.MYD
            }}

            After stopping the server, also does not remove the files. We have to remove the files manually.

            We have tried changing the variable default_tmp_storage_engine from MyISAM to InnoDB and the counter Slave_open_temp_tables also keeps growing but, of course, we don't see any temp files on tmpdir, but we believe that eventually something will broke inside InnoDB.

            We have been analyzing the binary log and it appears that all explicit create temporary tables are being dropped, either manually by the application, or automatically by the master after session close. Could these stale temporary tables be internal temporary tables that the server is using to resolve some difficult queries?
            We have 4 slaves using MariaDB 10.2 doing replication from a 10.2 master. Binary log format is MIXED and temporary tables are using MyISAM format. The number of temporary tables on the slave is growing continuously up to the point of exhausting the file descriptor limit of the operating system assigned to the process. After that the only solution is stopping the slave server and starting again.

            This was happening with 10.2.17 on the slaves. We have upgraded to 10.2.18 and the behavior is the same.

            The Slave_open_temp_tables variable counter goes up and is consistent with the number of #sql*.MYD files on the tmpdir.

            {{mainro [(none)]> SHOW STATUS LIKE 'Slave_open_temp_tables';
            +------------------------+-------+
            | Variable_name | Value |
            +------------------------+-------+
            | Slave_open_temp_tables | 3665 |
            +------------------------+-------+
            1 row in set (0.00 sec)}}

            {{# cd /var/db/tmp ; ls -l *.MYD | wc -l
            3665}}

            The server does not delete the tmp files from different slave sql threads execution. For example:

            {{-rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff2c.MYD
            -rw-rw---- 1 mysql mysql 1604 Oct 9 16:46 #sql4bb4_4809_ff42.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ff43.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff45.MYD
            -rw-rw---- 1 mysql mysql 2912 Oct 9 16:46 #sql4bb4_4809_ff5b.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ff5c.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff5e.MYD
            -rw-rw---- 1 mysql mysql 5928 Oct 9 16:46 #sql4bb4_4809_ffb1.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ffb2.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ffb4.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:34 #sql4bb4_77_10488.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:34 #sql4bb4_77_10489.MYD
            -rw-rw---- 1 mysql mysql 24 Oct 8 17:36 #sql4bb4_77_10866.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:37 #sql4bb4_77_10a73.MYD
            -rw-rw---- 1 mysql mysql 468 Oct 8 14:07 #sql4bb4_77_10.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:46 #sql4bb4_77_11ade.MYD
            -rw-rw---- 1 mysql mysql 1468 Oct 8 17:46 #sql4bb4_77_11b1e.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 8 17:46 #sql4bb4_77_11b1f.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:46 #sql4bb4_77_11b21.MYD
            -rw-rw---- 1 mysql mysql 1352 Oct 8 17:46 #sql4bb4_77_11b35.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 8 17:46 #sql4bb4_77_11b36.MYD}}

            After stopping the server, also does not remove the files. We have to remove the files manually.

            We have tried changing the variable default_tmp_storage_engine from MyISAM to InnoDB and the counter Slave_open_temp_tables also keeps growing but, of course, we don't see any temp files on tmpdir, but we believe that eventually something will broke inside InnoDB.

            We have been analyzing the binary log and it appears that all explicit create temporary tables are being dropped, either manually by the application, or automatically by the master after session close. Could these stale temporary tables be internal temporary tables that the server is using to resolve some difficult queries?
            danblack Daniel Black made changes -
            Description We have 4 slaves using MariaDB 10.2 doing replication from a 10.2 master. Binary log format is MIXED and temporary tables are using MyISAM format. The number of temporary tables on the slave is growing continuously up to the point of exhausting the file descriptor limit of the operating system assigned to the process. After that the only solution is stopping the slave server and starting again.

            This was happening with 10.2.17 on the slaves. We have upgraded to 10.2.18 and the behavior is the same.

            The Slave_open_temp_tables variable counter goes up and is consistent with the number of #sql*.MYD files on the tmpdir.

            {{mainro [(none)]> SHOW STATUS LIKE 'Slave_open_temp_tables';
            +------------------------+-------+
            | Variable_name | Value |
            +------------------------+-------+
            | Slave_open_temp_tables | 3665 |
            +------------------------+-------+
            1 row in set (0.00 sec)}}

            {{# cd /var/db/tmp ; ls -l *.MYD | wc -l
            3665}}

            The server does not delete the tmp files from different slave sql threads execution. For example:

            {{-rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff2c.MYD
            -rw-rw---- 1 mysql mysql 1604 Oct 9 16:46 #sql4bb4_4809_ff42.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ff43.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff45.MYD
            -rw-rw---- 1 mysql mysql 2912 Oct 9 16:46 #sql4bb4_4809_ff5b.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ff5c.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff5e.MYD
            -rw-rw---- 1 mysql mysql 5928 Oct 9 16:46 #sql4bb4_4809_ffb1.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ffb2.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ffb4.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:34 #sql4bb4_77_10488.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:34 #sql4bb4_77_10489.MYD
            -rw-rw---- 1 mysql mysql 24 Oct 8 17:36 #sql4bb4_77_10866.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:37 #sql4bb4_77_10a73.MYD
            -rw-rw---- 1 mysql mysql 468 Oct 8 14:07 #sql4bb4_77_10.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:46 #sql4bb4_77_11ade.MYD
            -rw-rw---- 1 mysql mysql 1468 Oct 8 17:46 #sql4bb4_77_11b1e.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 8 17:46 #sql4bb4_77_11b1f.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:46 #sql4bb4_77_11b21.MYD
            -rw-rw---- 1 mysql mysql 1352 Oct 8 17:46 #sql4bb4_77_11b35.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 8 17:46 #sql4bb4_77_11b36.MYD}}

            After stopping the server, also does not remove the files. We have to remove the files manually.

            We have tried changing the variable default_tmp_storage_engine from MyISAM to InnoDB and the counter Slave_open_temp_tables also keeps growing but, of course, we don't see any temp files on tmpdir, but we believe that eventually something will broke inside InnoDB.

            We have been analyzing the binary log and it appears that all explicit create temporary tables are being dropped, either manually by the application, or automatically by the master after session close. Could these stale temporary tables be internal temporary tables that the server is using to resolve some difficult queries?
            We have 4 slaves using MariaDB 10.2 doing replication from a 10.2 master. Binary log format is MIXED and temporary tables are using MyISAM format. The number of temporary tables on the slave is growing continuously up to the point of exhausting the file descriptor limit of the operating system assigned to the process. After that the only solution is stopping the slave server and starting again.

            This was happening with 10.2.17 on the slaves. We have upgraded to 10.2.18 and the behavior is the same.

            The Slave_open_temp_tables variable counter goes up and is consistent with the number of #sql*.MYD files on the tmpdir.

            {noformat}mainro [(none)]> SHOW STATUS LIKE 'Slave_open_temp_tables';
            +------------------------+-------+
            | Variable_name | Value |
            +------------------------+-------+
            | Slave_open_temp_tables | 3665 |
            +------------------------+-------+
            1 row in set (0.00 sec){noformat}

            {noformat}# cd /var/db/tmp ; ls -l *.MYD | wc -l
            3665{noformat}

            The server does not delete the tmp files from different slave sql threads execution. For example:

            {noformat}-rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff2c.MYD
            -rw-rw---- 1 mysql mysql 1604 Oct 9 16:46 #sql4bb4_4809_ff42.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ff43.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff45.MYD
            -rw-rw---- 1 mysql mysql 2912 Oct 9 16:46 #sql4bb4_4809_ff5b.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ff5c.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ff5e.MYD
            -rw-rw---- 1 mysql mysql 5928 Oct 9 16:46 #sql4bb4_4809_ffb1.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 9 16:46 #sql4bb4_4809_ffb2.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 9 16:46 #sql4bb4_4809_ffb4.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:34 #sql4bb4_77_10488.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:34 #sql4bb4_77_10489.MYD
            -rw-rw---- 1 mysql mysql 24 Oct 8 17:36 #sql4bb4_77_10866.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:37 #sql4bb4_77_10a73.MYD
            -rw-rw---- 1 mysql mysql 468 Oct 8 14:07 #sql4bb4_77_10.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:46 #sql4bb4_77_11ade.MYD
            -rw-rw---- 1 mysql mysql 1468 Oct 8 17:46 #sql4bb4_77_11b1e.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 8 17:46 #sql4bb4_77_11b1f.MYD
            -rw-rw---- 1 mysql mysql 0 Oct 8 17:46 #sql4bb4_77_11b21.MYD
            -rw-rw---- 1 mysql mysql 1352 Oct 8 17:46 #sql4bb4_77_11b35.MYD
            -rw-rw---- 1 mysql mysql 84 Oct 8 17:46 #sql4bb4_77_11b36.MYD{noformat}

            After stopping the server, also does not remove the files. We have to remove the files manually.

            We have tried changing the variable default_tmp_storage_engine from MyISAM to InnoDB and the counter Slave_open_temp_tables also keeps growing but, of course, we don't see any temp files on tmpdir, but we believe that eventually something will broke inside InnoDB.

            We have been analyzing the binary log and it appears that all explicit create temporary tables are being dropped, either manually by the application, or automatically by the master after session close. Could these stale temporary tables be internal temporary tables that the server is using to resolve some difficult queries?
            gomita Gabriel Gomiz made changes -
            gomita Gabriel Gomiz added a comment -

            Anyone know how can I find the names of these stale temporary tables? It would be very useful for debugging...

            gomita Gabriel Gomiz added a comment - Anyone know how can I find the names of these stale temporary tables? It would be very useful for debugging...
            elenst Elena Stepanova made changes -
            Component/s Replication [ 10100 ]
            elenst Elena Stepanova made changes -
            Assignee Andrei Elkin [ elkin ]
            gomita Gabriel Gomiz added a comment -

            We finally found a workaround to bug MDEV-17490 and managed to get a MariaDB 10.3.10 slave to replicate from our 10.2.18 master.

            Then, we can confirm this bug is still there on 10.3.10. The slave keeps leaking temporary tables.

            If yo need any more detail , please let me know

            gomita Gabriel Gomiz added a comment - We finally found a workaround to bug MDEV-17490 and managed to get a MariaDB 10.3.10 slave to replicate from our 10.2.18 master. Then, we can confirm this bug is still there on 10.3.10. The slave keeps leaking temporary tables. If yo need any more detail , please let me know
            Elkin Andrei Elkin added a comment -

            Confirming that _After stopping the server, also does not remove the files. _ The temporary files
            are removed though "lazily" at the following server start. And I agree there's little sense of keeping them
            in while they are destined to removal.

            Elkin Andrei Elkin added a comment - Confirming that _After stopping the server, also does not remove the files. _ The temporary files are removed though "lazily" at the following server start. And I agree there's little sense of keeping them in while they are destined to removal.
            gomita Gabriel Gomiz added a comment -

            Andrei, I can confirm that the *.MY? files in our tmpdir are NOT removed at the following server start. As a matter of fact, files are named #sqlXXXX_YY_ZZZ.MY? where XXXX is the process PID number. What files would the following server remove at start? The new instance doesn't know the previous server PID..., and if deletes all temp files, maybe could be deleting temporary files of other MariaDB running instances.

            Maybe this is another problem on the master, because it started after we have upgraded the master from MySQL 5.6 to MariaDB 10.2. I can confirm that previously (with MySQL 5.6 master) this problem doesn't existed. And could be somewhat related to the 17490 bug, because of misplaced "DROP TEMPORARY TABLES" statements in the binary log?

            Finally, I agree that those files are destined to removal but should be removed as soon as posible as long as they are not needed any more for subsequent queries because the actual behavior ends up exhausting the operating system file descriptor limit for the MariaDB process and after that the only solution is thu shutdown server process.

            Please let me know if I can help you debug this further

            Kind regards

            gomita Gabriel Gomiz added a comment - Andrei, I can confirm that the *.MY? files in our tmpdir are NOT removed at the following server start. As a matter of fact, files are named #sqlXXXX_YY_ZZZ.MY? where XXXX is the process PID number. What files would the following server remove at start? The new instance doesn't know the previous server PID..., and if deletes all temp files, maybe could be deleting temporary files of other MariaDB running instances. Maybe this is another problem on the master, because it started after we have upgraded the master from MySQL 5.6 to MariaDB 10.2. I can confirm that previously (with MySQL 5.6 master) this problem doesn't existed. And could be somewhat related to the 17490 bug, because of misplaced "DROP TEMPORARY TABLES" statements in the binary log? Finally, I agree that those files are destined to removal but should be removed as soon as posible as long as they are not needed any more for subsequent queries because the actual behavior ends up exhausting the operating system file descriptor limit for the MariaDB process and after that the only solution is thu shutdown server process. Please let me know if I can help you debug this further Kind regards
            elenst Elena Stepanova made changes -
            Fix Version/s 10.2 [ 14601 ]
            danblack Daniel Black added a comment -

            I suspect MDEV-15584 would make temporary files not appear on the filesystem in 10.4+

            danblack Daniel Black added a comment - I suspect MDEV-15584 would make temporary files not appear on the filesystem in 10.4+
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 90039 ] MariaDB v4 [ 140971 ]
            mariadb-jira-automation Jira Automation (IT) made changes -
            Zendesk Related Tickets 170302

            I agree with danblack that the temporary files wouldn't appear on the file system, though I don't necessarily know if that hides it away from the OS's open file descriptor statistics; or if the space of those tmp files files is ever reclaimed (while mariadbd is running). If danblack can answer that off the top of his head, we can close this; otherwise, there's still probably some cleanup work to do.

            bnestere Brandon Nesterenko added a comment - I agree with danblack that the temporary files wouldn't appear on the file system, though I don't necessarily know if that hides it away from the OS's open file descriptor statistics; or if the space of those tmp files files is ever reclaimed (while mariadbd is running). If danblack can answer that off the top of his head, we can close this; otherwise, there's still probably some cleanup work to do.
            danblack Daniel Black added a comment -

            Seems i was wrong. The tmp files used by the replication thread which would create aria or myisam tables that neither use create_tenp_file or use the O_TMPFILE flag.

            10.5

            $ git grep create_temp_file storage/maria/ storage/myisam
            $ git grep O_TMPFILE storage/maria/ storage/myisam
            

            On the O_TMPFILES, its like opening a file and then having it removed, once the open file descriptor is close or the process is killed, the OS frees it up.

            The problem description is the increasing of file descriptors which using O_TMPFILES won't solve, but it will cleanup nicely.

            danblack Daniel Black added a comment - Seems i was wrong. The tmp files used by the replication thread which would create aria or myisam tables that neither use create_tenp_file or use the O_TMPFILE flag. 10.5 $ git grep create_temp_file storage/maria/ storage/myisam $ git grep O_TMPFILE storage/maria/ storage/myisam On the O_TMPFILES, its like opening a file and then having it removed, once the open file descriptor is close or the process is killed, the OS frees it up. The problem description is the increasing of file descriptors which using O_TMPFILES won't solve, but it will cleanup nicely.
            danblack Daniel Black made changes -
            danblack Daniel Black added a comment -

            Added MDEV-35860 as an option to resolve the cleanup efforts with O_TMPFILE.

            On the general leak that caused this problem I guess validating the code paths around the flags HA_CREATE_TMP_TABLE (SQL inplicit) HA_CREATE_GLOBAL_TMP_TABLE (replication thread SQL implicit).

            As a replication statement to test create table t as (SELECT * FROM test) UNION (SELECT * FROM test);

            danblack Daniel Black added a comment - Added MDEV-35860 as an option to resolve the cleanup efforts with O_TMPFILE. On the general leak that caused this problem I guess validating the code paths around the flags HA_CREATE_TMP_TABLE (SQL inplicit) HA_CREATE_GLOBAL_TMP_TABLE (replication thread SQL implicit). As a replication statement to test create table t as (SELECT * FROM test) UNION (SELECT * FROM test);
            julien.fritsch Julien Fritsch made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            serg Sergei Golubchik made changes -
            Priority Critical [ 2 ] Major [ 3 ]
            serg Sergei Golubchik made changes -
            Assignee Andrei Elkin [ elkin ] Susil Behera [ JIRAUSER40751 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.2(EOL) [ 14601 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.5.29 [ 29996 ]
            Fix Version/s 10.5 [ 23123 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.5.29 [ 29996 ]
            susil.behera Susil Behera added a comment -

            serg I'm trying to repro the problem locally.

            susil.behera Susil Behera added a comment - serg I'm trying to repro the problem locally.
            susil.behera Susil Behera added a comment -

            I couldn't build/compile 10.2.17 (using tag mariadb-10.2.17) on my Ubuntu 24.04.1 LTS. I got the following error,

            -- Found GnuTLS: /usr/lib/x86_64-linux-gnu/libgnutls.so (found suitable version "3.8.3", minimum required is "3.3.24") 
            -- TLS library/version: GnuTLS 3.8.3
            -- SYSTEM_LIBS m;m;/usr/lib/x86_64-linux-gnu/libgnutls.so
            -- Dynamic column API support: ON
            -- GSSAPI: DYNAMIC
            SYSTEM processor: x86_64
            CMake Error at libmariadb/cmake/ConnectorName.cmake:30 (ENDMACRO):
              Flow control statements are not properly nested.
            Call Stack (most recent call first):
              libmariadb/CMakeLists.txt:406 (INCLUDE)
            

            So I tested on 10.2.44. I performed the following steps on a 1->2 replication setup,

            --slave
            SET GLOBAL default_tmp_storage_engine = 'MyISAM';
            --master
            SET GLOBAL binlog_format = MIXED;
             
            --master
            CREATE TABLE t1 (c1 TEXT, c2 TEXT);
            INSERT INTO t1 VALUES (REPEAT('x', 1000), REPEAT('y', 1000));
            INSERT INTO t1 SELECT * FROM t1;
            INSERT INTO t1 SELECT * FROM t1;
            INSERT INTO t1 SELECT * FROM t1;
            INSERT INTO t1 SELECT * FROM t1;
            INSERT INTO t1 SELECT * FROM t1;
            INSERT INTO t1 SELECT * FROM t1;
            INSERT INTO t1 SELECT * FROM t1;
            INSERT INTO t1 SELECT * FROM t1;
            INSERT INTO t1 SELECT * FROM t1;
            CREATE TABLE t2 AS (SELECT * FROM t1) UNION (SELECT * FROM t1);
             
            --slave
            10.2.44-opt>SHOW STATUS LIKE 'Slave_open_temp_tables';
            +------------------------+-------+
            | Variable_name          | Value |
            +------------------------+-------+
            | Slave_open_temp_tables | 0     |
            +------------------------+-------+
            1 row in set (0.00 sec)
            

            I couldn't hit the problem with the above steps on 1->2 replication setup. I'm trying to perform the same on a single master and 4 slave setup.

            susil.behera Susil Behera added a comment - I couldn't build/compile 10.2.17 (using tag mariadb-10.2.17) on my Ubuntu 24.04.1 LTS . I got the following error, -- Found GnuTLS: /usr/lib/x86_64-linux-gnu/libgnutls.so (found suitable version "3.8.3", minimum required is "3.3.24") -- TLS library/version: GnuTLS 3.8.3 -- SYSTEM_LIBS m;m;/usr/lib/x86_64-linux-gnu/libgnutls.so -- Dynamic column API support: ON -- GSSAPI: DYNAMIC SYSTEM processor: x86_64 CMake Error at libmariadb/cmake/ConnectorName.cmake:30 (ENDMACRO): Flow control statements are not properly nested. Call Stack (most recent call first): libmariadb/CMakeLists.txt:406 (INCLUDE) So I tested on 10.2.44. I performed the following steps on a 1->2 replication setup, --slave SET GLOBAL default_tmp_storage_engine = 'MyISAM'; --master SET GLOBAL binlog_format = MIXED;   --master CREATE TABLE t1 (c1 TEXT, c2 TEXT); INSERT INTO t1 VALUES (REPEAT('x', 1000), REPEAT('y', 1000)); INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; CREATE TABLE t2 AS (SELECT * FROM t1) UNION (SELECT * FROM t1);   --slave 10.2.44-opt>SHOW STATUS LIKE 'Slave_open_temp_tables'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | Slave_open_temp_tables | 0 | +------------------------+-------+ 1 row in set (0.00 sec) I couldn't hit the problem with the above steps on 1->2 replication setup. I'm trying to perform the same on a single master and 4 slave setup.

            If you want to check 10.2.17, you can try a release bintar. I don't know if it works on Ubuntu 24.04, but at least mariadb-10.2.15-linux-glibc_214-x86_64.tar.gz works on my Debian 12.

            elenst Elena Stepanova added a comment - If you want to check 10.2.17, you can try a release bintar . I don't know if it works on Ubuntu 24.04, but at least mariadb-10.2.15-linux-glibc_214-x86_64.tar.gz works on my Debian 12.
            susil.behera Susil Behera added a comment -

            10.2 is EOL and the bug isn't present in any still supported version.

            susil.behera Susil Behera added a comment - 10.2 is EOL and the bug isn't present in any still supported version.
            susil.behera Susil Behera made changes -
            issue.field.resolutiondate 2025-02-11 15:34:54.0 2025-02-11 15:34:53.789
            susil.behera Susil Behera made changes -
            Fix Version/s N/A [ 14700 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Resolution Won't Fix [ 2 ]
            Status Open [ 1 ] Closed [ 6 ]

            People

              susil.behera Susil Behera
              gomita Gabriel Gomiz
              Votes:
              1 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.