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

Deadlock with vBulletin server and replication

Details

    Description

      I have a vBulletin server running (v4.2.5), with PHP 7.1. They were running on the 10.1 version from the apt repositories from Debian (mariadb-server-core-10.1/stable 10.1.38-0+deb9u1).

      I decided to upgrade the MariaDB using the MariaDB apt repo, which gave me an upgrade to 10.3.14.

      The database is replicated onto another server with the same OS / MariaDB version from stratch (Debian 9 / MariaDB 10.3).

      Replication works fine :

      MariaDB [(none)]> show slave status \G
      *************************** 1. row ***************************
                      Slave_IO_State: Waiting for master to send event
                         Master_User: replication_user
                       Connect_Retry: 10
                     Master_Log_File: master1-bin.000319
                     Read_Master_Log_Pos: 56225430
                       Relay_Log_Pos: 56223609
                  Relay_Master_Log_File: master1-bin.000319
                    Slave_IO_Running: Yes
                   Slave_SQL_Running: Yes
      

      Now, whenever someone opens multiple threads in a very short time range, they will likely be facing a "Database error". As an admin, I can see what the error is, and I can guarantee that this wasn't present when the database used was MariaDB 10.1.

      I opened a thread on the vBulletin support, but they told me there shouldn't be any issues on this type from the version I'm using, and they don't test every MariaDB version so they can't confirm the problem.

      Is any help possible here ?

      Here is the error I'm getting when it occurs :

      Invalid SQL:
      REPLACE INTO forum_ipdata
          (rectype, userid, contentid, contenttypeid, dateline, ip, altip)
      VALUES
          ('view', 13574, 121872, 2, 1556868134, '82.64.xxx.xxx', '82.64.xxx.xxx');
       
      MySQL Error   : Deadlock found when trying to get lock; try restarting transaction
      Error Number  : 1213
      Request Date  : Friday, May 3rd 2019 @ 09:22:14 AM
      Error Date    : Friday, May 3rd 2019 @ 09:22:15 AM
      Script        : http://mysuperforum/threads/123456-any-thread
      Referrer      : 
      IP Address    : xx.xx.xx.xx
      Username      : Wobak
      Classname     : vB_Database_MySQLi
      MySQL Version : 10.3.14-MariaDB-1:10.3.14+maria~stretch-log
      Server        :  xx.xx.xxx.xx
      User Agent    :
      

      (I masked the IPs)

      Tables are running in InnoDB for almost all the tables (the issue also occured when they were in MyISAM).

      Could this be due to replication ?
      Is there anything I can provide to help fix this ?

      Thanks,

      Attachments

        Issue Links

          Activity

            Thank you for that link. I updated the database to 10.3.15, it seems that the issue is gone indeed.

            I'll monitor for 3-4 days, and if it doesn't reappear, I'll close this.

            Thanks,

            Wobak Thibaut Perrin added a comment - Thank you for that link. I updated the database to 10.3.15, it seems that the issue is gone indeed. I'll monitor for 3-4 days, and if it doesn't reappear, I'll close this. Thanks,
            Elkin Andrei Elkin added a comment -

            Wobak, thanks for reporting! One suggestion for any new replication report though please try making it
            clear where an error occurs (I can only guess that the slave is meant in this case). And since it's a deadlock show processlist is necessary. Cheers.

            Elkin Andrei Elkin added a comment - Wobak , thanks for reporting! One suggestion for any new replication report though please try making it clear where an error occurs (I can only guess that the slave is meant in this case). And since it's a deadlock show processlist is necessary. Cheers.
            Wobak Thibaut Perrin added a comment - - edited

            Hi,

            As the error is instantaneous and disappears with a page reload, the show processlist doesn't show anything useful :

            MariaDB [(none)]> show processlist
                -> ;
            +------+-------------+-----------+------+-----------+-------+-----------------------------------------------------------------------------+------------------+----------+
            | Id   | User        | Host      | db   | Command   | Time  | State                                                                       | Info             | Progress |
            +------+-------------+-----------+------+-----------+-------+-----------------------------------------------------------------------------+------------------+----------+
            |    2 | system user |           | NULL | Daemon    |  NULL | InnoDB purge worker                                                         | NULL             |    0.000 |
            |    1 | system user |           | NULL | Daemon    |  NULL | InnoDB purge coordinator                                                    | NULL             |    0.000 |
            |    3 | system user |           | NULL | Daemon    |  NULL | InnoDB purge worker                                                         | NULL             |    0.000 |
            |    4 | system user |           | NULL | Daemon    |  NULL | InnoDB purge worker                                                         | NULL             |    0.000 |
            |    5 | system user |           | NULL | Daemon    |  NULL | InnoDB shutdown handler                                                     | NULL             |    0.000 |
            |    9 | system user |           | NULL | Slave_IO  | 62152 | Waiting for master to send event                                            | NULL             |    0.000 |
            |   10 | system user |           | NULL | Slave_SQL |     0 | Slave has read all relay log; waiting for the slave I/O thread to update it | NULL             |    0.000 |
            | 1051 | root        | localhost | NULL | Query     |     0 | Init                                                                        | show processlist |    0.000 |
            +------+-------------+-----------+------+-----------+-------+-----------------------------------------------------------------------------+------------------+----------+
            8 rows in set (0.000 sec)
            

            Also, unfortunately, the error still exists even when master and slave are running 10.3.15

            Wobak Thibaut Perrin added a comment - - edited Hi, As the error is instantaneous and disappears with a page reload, the show processlist doesn't show anything useful : MariaDB [(none)]> show processlist -> ; +------+-------------+-----------+------+-----------+-------+-----------------------------------------------------------------------------+------------------+----------+ | Id | User | Host | db | Command | Time | State | Info | Progress | +------+-------------+-----------+------+-----------+-------+-----------------------------------------------------------------------------+------------------+----------+ | 2 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 | | 1 | system user | | NULL | Daemon | NULL | InnoDB purge coordinator | NULL | 0.000 | | 3 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 | | 4 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 | | 5 | system user | | NULL | Daemon | NULL | InnoDB shutdown handler | NULL | 0.000 | | 9 | system user | | NULL | Slave_IO | 62152 | Waiting for master to send event | NULL | 0.000 | | 10 | system user | | NULL | Slave_SQL | 0 | Slave has read all relay log; waiting for the slave I /O thread to update it | NULL | 0.000 | | 1051 | root | localhost | NULL | Query | 0 | Init | show processlist | 0.000 | +------+-------------+-----------+------+-----------+-------+-----------------------------------------------------------------------------+------------------+----------+ 8 rows in set (0.000 sec) Also, unfortunately, the error still exists even when master and slave are running 10.3.15
            Elkin Andrei Elkin added a comment -

            Wobak Thank you for the report! What was the slave configuration - do you still have its cnf file and a show-global-variables log?

            Elkin Andrei Elkin added a comment - Wobak Thank you for the report! What was the slave configuration - do you still have its cnf file and a show-global-variables log?

            Hi Andrei,

            The issue seems to be gone since I updated both Master and Slave to 10.3.18-MariaDB

            1. mysql --version
              mysql Ver 15.1 Distrib 10.3.18-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

            Do you still need that info ?

            Wobak Thibaut Perrin added a comment - Hi Andrei, The issue seems to be gone since I updated both Master and Slave to 10.3.18-MariaDB mysql --version mysql Ver 15.1 Distrib 10.3.18-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 Do you still need that info ?
            Elkin Andrei Elkin added a comment - - edited

            Wobak, salute. Not this does not look urgent as apparently you moved away from reproducing context. Hopefully it was something that got fixed already.Nevertheless, could you tell us whether the slave was in parallel mode (slave_parallel_threads > 0)?

            Cheers.

            Elkin Andrei Elkin added a comment - - edited Wobak , salute. Not this does not look urgent as apparently you moved away from reproducing context. Hopefully it was something that got fixed already.Nevertheless, could you tell us whether the slave was in parallel mode ( slave_parallel_threads > 0 )? Cheers.

            MariaDB [(none)]> show global variables where variable_name like 'slave_%';
            ----------------------------------------------+

            Variable_name Value

            ----------------------------------------------+

            slave_compressed_protocol OFF
            slave_ddl_exec_mode IDEMPOTENT
            slave_domain_parallel_threads 0
            slave_exec_mode STRICT
            slave_load_tmpdir /tmp
            slave_max_allowed_packet 1073741824
            slave_net_timeout 60
            slave_parallel_max_queued 131072
            slave_parallel_mode conservative
            slave_parallel_threads 0
            slave_parallel_workers 0
            Wobak Thibaut Perrin added a comment - MariaDB [(none)] > show global variables where variable_name like 'slave_%'; --------------------------------- -------------+ Variable_name Value --------------------------------- -------------+ slave_compressed_protocol OFF slave_ddl_exec_mode IDEMPOTENT slave_domain_parallel_threads 0 slave_exec_mode STRICT slave_load_tmpdir /tmp slave_max_allowed_packet 1073741824 slave_net_timeout 60 slave_parallel_max_queued 131072 slave_parallel_mode conservative slave_parallel_threads 0 slave_parallel_workers 0
            Elkin Andrei Elkin added a comment -

            Thanks, Wobak! It was not parallel. I suggest we close it. Feel free to express any other opinion or act to close.

            Elkin Andrei Elkin added a comment - Thanks, Wobak ! It was not parallel. I suggest we close it. Feel free to express any other opinion or act to close.

            People

              Elkin Andrei Elkin
              Wobak Thibaut Perrin
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.