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

innodb_log_archive=ON may crash if os_file_set_size() is interrupted

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      mleich shared an rr replay trace where InnoDB intentionally crashes itself because we failed to allocate an innodb_log_archive log file. In this case, we did not have errno=ENOSPC, but instead, errno=EINTR was set in the following stack trace:

      #0  0x00007d8af591c6f4 in fallocate64 (fd=fd@entry=3, mode=mode@entry=0, offset=offset@entry=0, len=len@entry=25993216) at ../sysdeps/unix/sysv/linux/fallocate64.c:27
      #1  0x00005e439db8eeb6 in os_file_set_size (name=0x758ae00035f0 "ib_00000000018ca000.log", file=file@entry=3, size=25993216, is_sparse=is_sparse@entry=false)
          at /data/Server/MDEV-14992C_MDEV-40932/storage/innobase/os/os0file.cc:1582
      #2  0x00005e439db45839 in log_t::archive_create (this=this@entry=0x5e439f4e29c0 <log_sys>, lsn=<optimized out>, ex=ex@entry=true) at /usr/include/c++/13/bits/basic_string.h:222
      #3  0x00005e439db45dba in log_t::archive_new_write (this=this@entry=0x5e439f4e29c0 <log_sys>, buf=0x758ae5e00200 "e", buf@entry=0x758ae5e00000 "\032\02675", length=1024, length@entry=1536, 
          offset=offset@entry=25992704) at /data/Server/MDEV-14992C_MDEV-40932/storage/innobase/log/log0log.cc:1331
      #4  0x00005e439db46676 in log_t::write_buf<(log_t::resizing_and_latch)1> (this=0x5e439f4e29c0 <log_sys>) at /data/Server/MDEV-14992C_MDEV-40932/storage/innobase/log/log0log.cc:1822
      #5  log_writer () at /data/Server/MDEV-14992C_MDEV-40932/storage/innobase/log/log0log.cc:1970
      #6  0x00005e439db43342 in log_write_up_to (lsn=lsn@entry=25993777, durable=durable@entry=true, callback=<optimized out>, callback@entry=0x0)
          at /data/Server/MDEV-14992C_MDEV-40932/storage/innobase/log/log0log.cc:1929
      #7  0x00005e439dce656b in log_checkpoint_low (oldest_lsn=oldest_lsn@entry=25993113, end_lsn=end_lsn@entry=25993113) at /data/Server/MDEV-14992C_MDEV-40932/storage/innobase/buf/buf0flu.cc:2333
      #8  0x00005e439dce8960 in buf_flush_sync_for_checkpoint (lsn=lsn@entry=25993113) at /data/Server/MDEV-14992C_MDEV-40932/storage/innobase/buf/buf0flu.cc:2597
      #9  0x00005e439dce8d79 in buf_flush_page_cleaner () at /data/Server/MDEV-14992C_MDEV-40932/storage/innobase/buf/buf0flu.cc:2893
      

      The Linux documentation says:

      fallocate(2) ERRORS

           EINTR  A signal was caught during execution; see signal(7).
      

      It was the intention of MDEV-37949 to intentionally crash when we run out of space, but not when there is an attempt to shut down the server while we happen to be creating a new archive log file. For normal data file extension, we do want os_file_set_size() to terminate during server shutdown.

      Each invocation of os_file_set_size() needs to be reviewed and adjusted for this. I think that it could be simplest to add a parameter to the function that requests it to retry on soft errors, such as EINTR.

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              Matthias Leich Matthias Leich
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 1h Remaining Estimate - 1d 7h
                  1d 7h
                  Logged:
                  Time Spent - 1h Remaining Estimate - 1d 7h
                  1h

                  Git Integration

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