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

Server crash seen when query tries to acquire row locks with skip locked

    XMLWordPrintable

Details

    Description

      Issue:
      --------
      Server errors and crashes with innodb-buffer-pool-size=128M ,when query tries to acquire row lock on table with 10M rows , which has been already locked by other session.

      session1:
      -------------
      select count(*) from t for update; //Acquires row lock on every rows of table

      session2:
      --------------
      select count(*) from t for update skip locked; // It should skip rows that are currently locked by other session and return rest ,since all rows are locked in 1st session , it should succesfully skip every row and return 0 i.e it can't acquire row lock on any of rows.

      But instead it errors and crashes.

      [ERROR] [FATAL] InnoDB: Over 95 percent of the buffer pool is occupied by lock heaps or the adaptive hash index! Check that your transactions do not set too many row locks, or review if innodb_buffer_pool_size=126M could be bigger

      How to repro:

      --------------------

      On release build , Start server with default innodb-buffer-pool-size=128M
       
      CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB;
      INSERT INTO t(a) SELECT seq FROM seq_0_to_10000000;
       
      1st session:
      ------------
      set autocommit=OFF;
      select count(*) from t for update;
       
      2nd session:
      ------------
      MariaDB [m8]> select count(*) from t for update skip locked;
      ERROR 2026 (HY000): TLS/SSL error: unexpected eof while reading
      

      Stack trace:

      -----------------

      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
      #3  handle_fatal_signal ()
      #4  <signal handler called>
      #5  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
      #6  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
      #7  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
      #8  __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #9  __GI_abort () at ./stdlib/abort.c:79
      #10 buf_LRU_check_size_of_non_data_objects() ()
      #11 buf_LRU_get_free_block(buf_LRU_get) ()
      #12 mem_heap_create_block_func(mem_block_info_t*, unsigned long, unsigned long) ()
      #13 mem_heap_add_block(mem_block_info_t*, unsigned long) ()
      #14 lock_rec_create(conflicting_lock_info const&, unsigned int, page_id_t, unsigned char const*, unsigned long, dict_index_t*, trx_t*, bool) ()
      #15 lock_rec_lock(bool, unsigned int, buf_block_t const*, unsigned long, dict_index_t*, que_thr_t*) ()
      #16 row_search_mvcc(unsigned char*, page_cur_mode_t, row_prebuilt_t*, unsigned long, unsigned long) ()
      #17 ha_innobase::rnd_next(unsigned char*) ()
      #18 handler::ha_rnd_next(unsigned char*) ()
      #19 rr_sequential(READ_RECORD*) ()
      #20 sub_select(JOIN*, st_join_table*, bool) ()
      #21 JOIN::exec_inner() ()
      #22 JOIN::exec() ()
      #23 mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) ()
      #24 handle_select(THD*, LEX*, select_result*, unsigned long long) ()
      #25 execute_sqlcom_select(THD*, TABLE_LIST*) ()
      #26 mysql_execute_command(THD*, bool) ()
      #27 mysql_parse(THD*, char*, unsigned int, Parser_state*) ()
      #28 dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) ()
      #29 do_command(THD*, bool) ()
      #30 do_handle_one_connection(CONNECT*, bool) ()
      #31 handle_one_connection ()
      #32 pfs_spawn_thread ()
      #33 start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
      #34 clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              mariadb-pavithrapandith Pavithra Pandith
              mariadb-pavithrapandith Pavithra Pandith
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 14m
                  14m

                  Git Integration

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