Innobackupex fails but return code is 0

I’m trying to write a backup script using innobackupex but I have problems determining that innobackupex ran successfully.
The log ends with the following output:

log scanned up to (9587670370542)
log scanned up to (9587670370542)
log scanned up to (9587670370542)
log scanned up to (9587670370542)
innobackupex: Error: Connection to mysql child process (pid=26032) timedout. (Time limit of 900 seconds exceeded. You may adjust time limit by editing the value of parameter “$mysql_response_timeout” in this script.) while waiting for reply to MySQL request: ‘FLUSH TABLES WITH READ LOCK;’ at /usr/bin/innobackupex line 381.
20130717 01:55:09: Backup finished (duration: 6608 seconds)

I check the return code of the innobackupex command but that is zero even though the command didn’t finish successfully.
Is this a known bug and what can I do to determine that the script actually ran ok?


This error means backup not completed successfully.
This error explains there is some query which executed bigger than $mysql_response_timeout and preventing lock with FTWRL if you taking backup from slave than most probably this is replication event causing this error. You should optimize your queries.
Other way is to use --no-lock option if all your tables are InnoDB. Also you can use --safe-slave-backup option which stops the replication sql_thread.

Forgot to mention earlier about innobackupex command reference for further read.

I understand that this is an error but innobackupex should actually return a proper error code so that backup scripts can detect this. Right now even though the backup failed because of this the innobackupex script results in a return code of zero which means it ran without errors and that’s obviously not correct.


i have an error while im giving wrong password and username, but i have error code “0” even the backup is not done

innobackupex: got a fatal error with the following stacktrace: at /usr/bin/innobackupex line 3011.
main::mysql_connect(“abort_on_error”, 1) called at /usr/bin/innobackupex line 1570
innobackupex: Error: Failed to connect to MySQL server: DBI connect(’;mysql_read_default_group=xtrabackup’,‘ROO’,…) failed: Access denied for user ‘ROO’@‘localhost’ (using password: YES) at /usr/bin/innobackupex line 2995.

root@mongo1:~# echo $?

What version of Percona Xtrabackup you are using ? Can you please also show us the exact command used for backup.
$ xtrabackup --version