# Xtrabackup not getting completed due lock\_wait\_timeout issue

**URL:** <https://forums.percona.com/t/xtrabackup-not-getting-completed-due-lock-wait-timeout-issue/11609>\
**Category:** Percona XtraBackup\
**Created:** [August 1, 2021, 9:27am UTC](https://forums.percona.com/t/xtrabackup-not-getting-completed-due-lock-wait-timeout-issue/11609 "2021-08-01T09:27:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rudrojit](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@Rudrojit](https://forums.percona.com/u/Rudrojit)\
**Post date:** [August 1, 2021, 9:27am UTC](https://forums.percona.com/t/xtrabackup-not-getting-completed-due-lock-wait-timeout-issue/11609/1 "2021-08-01T09:27:35Z")

</div>

Hello Community

I set up a backup of a 4TB MySQL-5.7.21 instance using percona-xtrabackup 2.4.21, The log shows the process started but got terminated with below error

210801 08:17:19 [01] …done  
210801 08:17:19 \>\> log scanned up to (3368741918185)  
Error: failed to execute query ‘SET SESSION lock\_wait\_timeout=31536000’: 2006 (HY000) MySQL server has gone away

I checked the global lock\_wait\_timeout variable and it is set to the exact value that the log shows  
mysql\> select @@lock\_wait\_timeout;  
±--------------------+  
| @@lock\_wait\_timeout |  
±--------------------+  
| 31536000 |  
±--------------------+  
1 row in set (0.00 sec)

mysql\> select @@innodb\_lock\_wait\_timeout;  
±---------------------------+  
| @@innodb\_lock\_wait\_timeout |  
±---------------------------+  
| 50 |  
±---------------------------+  
1 row in set (0.00 sec)

mysql\>

If anyone can provide a solution to resolve this would be great.

---

<div class="post-metadata">

**Author:** ![Marcelo\_Altmann](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/marcelo_altmann/32/11299_2.png) [@Marcelo\_Altmann](https://forums.percona.com/u/Marcelo_Altmann)\
**Post date:** [August 2, 2021, 11:20am UTC](https://forums.percona.com/t/xtrabackup-not-getting-completed-due-lock-wait-timeout-issue/11609/2 "2021-08-02T11:20:54Z")

</div>

MySQL is killing PXB connection. Can you please share the full backup log from start until the issue occurs ?  
Also, please adjust your mysql log\_error\_verbosity to 3 and upload your mysql error log too.

---

<div class="post-metadata">

**Author:** ![Rudrojit](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@Rudrojit](https://forums.percona.com/u/Rudrojit)\
**Post date:** [August 3, 2021, 5:34am UTC](https://forums.percona.com/t/xtrabackup-not-getting-completed-due-lock-wait-timeout-issue/11609/3 "2021-08-03T05:34:09Z")

</div>

Hi @Marcelo_Altmann

PFA xtrabackup log file for your reference.

This is already in place  
mysql\> select @@log\_error\_verbosity;  
±----------------------+  
| @@log\_error\_verbosity |  
±----------------------+  
| 3 |  
±----------------------+  
1 row in set (0.00 sec)

mysql.err log corresponding to xtrabackup issue shows below entry

2021-08-01T12:31:12.564446Z 473607 [Note] Aborted connection 473607 to db: ‘unconnected’ user: ‘dbbackup’ host: ‘localhost’ (Got an error reading communication packets)  
[percona-xtrabackup-2.4.21-logs-Error.txt](https://forums.percona.com/uploads/short-url/sraW71eMqEwjZDcQZ886PKC9E5Y.txt) (139.4 KB)

---

<div class="post-metadata">

**Author:** ![Marcelo\_Altmann](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/marcelo_altmann/32/11299_2.png) [@Marcelo\_Altmann](https://forums.percona.com/u/Marcelo_Altmann)\
**Post date:** [August 10, 2021, 11:19am UTC](https://forums.percona.com/t/xtrabackup-not-getting-completed-due-lock-wait-timeout-issue/11609/4 "2021-08-10T11:19:28Z")

</div>

Hi @Rudrojit

Here is the timeframe of events:

```auto
210801 11:08:11 Connecting to MySQL server host: localhost, user: dbbackup, password: set, port: 3306, socket: /bmp_test/config/mysql.sock

```

Xtrabackup connected to your db and started to do the backup of your files

```auto
2021-08-01T12:31:12.564446Z 473607 [Note] Aborted connection 473607 to db: ‘unconnected’ user: ‘dbbackup’ host: ‘localhost’ (Got an error reading communication packets)

```

It seems to have a TZ difference between the log events, but this happened around 23 minutes after PXB connected. MySQL closed the connection (probably due to inactivity)

```auto
Error: failed to execute query 'SET SESSION lock_wait_timeout=31536000': 2006 (HY000) MySQL server has gone away

```

PXB tried to execute a query but the connection has already been closed.

Xtrabackup when connecting, sets the `wait_timeout` to 2147483 (24+ days). This is the variable that controls how long an IDLE connection will remain open before been closed due to inactivity.

I suspect that you have some external tool like pt-kill that is killing idle connections.

---

<div class="post-metadata">

**Author:** ![Rudrojit](https://avatars.discourse-cdn.com/v4/letter/r/e47c2d/32.png) [@Rudrojit](https://forums.percona.com/u/Rudrojit)\
**Post date:** [August 13, 2021, 4:05pm UTC](https://forums.percona.com/t/xtrabackup-not-getting-completed-due-lock-wait-timeout-issue/11609/5 "2021-08-13T16:05:00Z")

</div>

@Marcelo_Altmann  
Thanks, I will change the wait\_timeout parameter and see if it helps.  
No, we are not using any tool like pt-kill, in fact, we are pitching to start using Percona MySQL instead of community server, this whole setup is a trial run on one of the test servers.  
I must say I am quite intrigued now to use Percona tool kit as well.
