# Xtrabackup chokes on a specific file

**URL:** <https://forums.percona.com/t/xtrabackup-chokes-on-a-specific-file/10295>\
**Category:** Percona XtraBackup\
**Created:** [April 29, 2021, 6:40am UTC](https://forums.percona.com/t/xtrabackup-chokes-on-a-specific-file/10295 "2021-04-29T06:40:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baptiste\_Mille-Mathi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/baptiste_mille-mathi/32/9237_2.png) [@Baptiste\_Mille-Mathi](https://forums.percona.com/u/Baptiste_Mille-Mathi)\
**Post date:** [April 29, 2021, 6:40am UTC](https://forums.percona.com/t/xtrabackup-chokes-on-a-specific-file/10295/1 "2021-04-29T06:40:55Z")

</div>

Hello,  
for the purpose of creating a new replica of a MySQL 5.7 server I use this command

```
xtrabackup --backup --stream=xbstream --parallel=4 /tmp | pigz -c --fast | nc -w 2 replica 2112

```

this is based on this [document](https://blog.pythian.com/mysql-streaming-xtrabackup-slave-recovery/).  
Normally it works fine (I have synced several replicas with the same method) but now it fails each time with such error after one hours

```
...
210428 10:56:59 Starting to backup non-InnoDB tables and files
210428 10:56:59 [01] Streaming ./db_187/twitter_scenarios.frm to <STDOUT>
210428 10:56:59 [01] ...done
xtrabackup: Error writing file 'UNOPENED' (Errcode: 32 - Broken pipe)
[01] Error: copy_file() failed.
Failed to copy file ./db_187/twitter_scenarios.frm

```

The file `./db_187/twitter_scenarios.frm` has no issue or permission problem.

Also it worth pointing I don’t understand why there is the line `Starting to backup non-InnoDB tables and files` before reaching this file because this table is innodb.

```auto
ls /var/lib/mysql/prod2_187/twitter_scenarios.* -al
-rw-r----- 1 mysql mysql 8762 Apr 28 14:36 /var/lib/mysql/db_187/twitter_scenarios.frm
-rw-r----- 1 mysql mysql 114688 Apr 28 12:53 /var/lib/mysql/db_187/twitter_scenarios.ibd

```

Do you have some advice to troubleshoot or even fix this issue ?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [April 29, 2021, 12:30pm UTC](https://forums.percona.com/t/xtrabackup-chokes-on-a-specific-file/10295/2 "2021-04-29T12:30:49Z")

</div>

> I don’t understand why there is the line `Starting to backup non-InnoDB tables and files` before reaching

The table is InnoDB. The FRM file is not.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [April 29, 2021, 12:33pm UTC](https://forums.percona.com/t/xtrabackup-chokes-on-a-specific-file/10295/3 "2021-04-29T12:33:19Z")

</div>

> [@Baptiste\_Mille-Mathi](#):
>
> Do you have some advice to troubleshoot or even fix this issue ?

Did the nc connection break? Try without parallel? Have you tried doing a local backup? (replace the nc with \>/path/to/backup.xbstream)

---

<div class="post-metadata">

**Author:** ![vadimtk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadimtk/32/9528_2.png) [@vadimtk](https://forums.percona.com/u/vadimtk)\
**Post date:** [April 29, 2021, 12:34pm UTC](https://forums.percona.com/t/xtrabackup-chokes-on-a-specific-file/10295/4 "2021-04-29T12:34:58Z")

</div>

Judging by the message  
“Error writing file ‘UNOPENED’ (Errcode: 32 - Broken pipe)”

I think the problem is on the receiving side.  
Probably network connection get broken and nc breaks connection?  
You use -w for timeout, what if you do not use this option?

---

<div class="post-metadata">

**Author:** ![Baptiste\_Mille-Mathi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/baptiste_mille-mathi/32/9237_2.png) [@Baptiste\_Mille-Mathi](https://forums.percona.com/u/Baptiste_Mille-Mathi)\
**Post date:** [April 29, 2021, 1:54pm UTC](https://forums.percona.com/t/xtrabackup-chokes-on-a-specific-file/10295/5 "2021-04-29T13:54:59Z")

</div>

I removed `-w2` from `nc` and indeed it works mostly except the connexion never close, so I can hardly use that in a script. I don’t understand either why it used to work without a problem during previous weeks and now it breaks.  
Perhaps I should replace `nc` by something else like `socat`.

Thanks

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [April 29, 2021, 2:51pm UTC](https://forums.percona.com/t/xtrabackup-chokes-on-a-specific-file/10295/6 "2021-04-29T14:51:59Z")

</div>

I’m wondering if pigz is keeping the IO open. We use `nc` in our training and it works perfectly. Repeat the backup but remove pigz. xtrabackup should close the IO stream, which should tell nc to close it as well. You’ll have the same issue with socat if pigz is indeed keeping the stream open.

If you want compression, try using `--compress` on xtrabackup. Or check the pigz man pages for how to make it auto close when the IO stream terminates.

---

<div class="post-metadata">

**Author:** ![Baptiste\_Mille-Mathi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/baptiste_mille-mathi/32/9237_2.png) [@Baptiste\_Mille-Mathi](https://forums.percona.com/u/Baptiste_Mille-Mathi)\
**Post date:** [April 29, 2021, 2:54pm UTC](https://forums.percona.com/t/xtrabackup-chokes-on-a-specific-file/10295/7 "2021-04-29T14:54:39Z")

</div>

Actually I just did another run but I replaced `-w 2` (no more timeout) by `-N` and it worked fine.  
`-N` is

> _shutdown(2) the network socket after EOF on the input. Some servers require this to finish their work._

Thanks for the advices and directions you gave me.  
really appreciated.
