binlog index corruption with closed stdout

Bug #1401547 reported by Alexander Polakov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.1
Won't Fix
Medium
Unassigned
5.5
Triaged
Medium
Unassigned
5.6
Triaged
Medium
Unassigned
5.7
Triaged
Medium
Unassigned

Bug Description

# mysqld --log_bin=test --help --verbose 1>&-

Running this command puts lines from "--help --verbose" output in $datadir/test.index.

I understand that this is mostly user error and probably not many people hit this, but it's annoying and hard to debug (and breaks replication!).

How does it happen? When mysqld is started this way, there's only one descriptor open (fd #1), and when index file is opened it gets next free fd (2), which is usually associated with stdout. Then printf() in my_print_help() prints right into the index file.

I'm running Percona 5.6.20-68.

Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :
Download full text (5.9 KiB)

Able to reproduce with PS 5.6.21

root@Dell-XPS:/var/lib/mysql# mysqld --log_bin=test --help --verbose 1>&-
2014-12-17 15:13:16 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2014-12-17 15:13:16 7559 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
2014-12-17 15:13:16 7559 [Note] Plugin 'FEDERATED' is disabled.
2014-12-17 15:13:16 7559 [Note] Binlog end
2014-12-17 15:13:16 7559 [Note] Shutting down plugin 'MyISAM'
2014-12-17 15:13:16 7559 [Note] Shutting down plugin 'CSV'
root@Dell-XPS:/var/lib/mysql# ;;
-su: syntax error near unexpected token `;;'
root@Dell-XPS:/var/lib/mysql# ll
total 518416
drwx------ 8 mysql mysql 4096 Dec 17 15:13 ./
drwxr-xr-x 72 root root 4096 Dec 5 16:02 ../
-rw-rw---- 1 mysql mysql 56 Nov 25 13:51 auto.cnf
-rw-r--r-- 1 mysql mysql 0 Nov 25 10:05 debian-5.5.flag
-rw-r--r-- 1 root root 0 Nov 25 13:51 debian-5.6.flag
-rw-rw---- 1 mysql mysql 65916 Dec 2 16:03 Dell-XPS-slow.log
-rw-rw---- 1 mysql mysql 429916160 Dec 17 14:45 ibdata1
-rw-rw---- 1 mysql mysql 50331648 Dec 17 14:45 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Dec 17 14:01 ib_logfile1
-rw-rw---- 1 mysql mysql 3553 Dec 17 14:01 log-slow-queries.log
drwx------ 2 mysql mysql 4096 Nov 25 13:51 mysql/
-rw-rw---- 1 mysql mysql 529 Dec 17 13:36 mysql-bin.000001
-rw-rw---- 1 mysql mysql 5472 Dec 17 13:49 mysql-bin.000002
-rw-rw---- 1 mysql mysql 374 Dec 17 14:45 mysql-bin.000003
-rw-rw---- 1 mysql mysql 96 Dec 17 13:49 mysql-bin.index
-rw-rw---- 1 mysql mysql 11 Nov 25 13:51 mysql_upgrade_info
drwx------ 2 mysql mysql 4096 Dec 15 15:16 nil/
drwx------ 2 mysql mysql 4096 Dec 17 13:38 njoshi/
drwx------ 2 mysql mysql 4096 Dec 15 15:20 percona_schema/
drwx------ 2 mysql mysql 4096 Nov 25 13:51 performance_schema/
drwx------ 2 mysql mysql 4096 Dec 10 13:08 test/
-rw-rw---- 1 mysql mysql 135168 Dec 17 15:13 test.index
root@Dell-XPS:/var/lib/mysql# cat test.index
mysqld Ver 5.6.21-70.1-log for debian-linux-gnu on x86_64 (Percona Server (GPL), Release 70.1, Revision 698)
Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Starts the MySQL database server.

Usage: mysqld [OPTIONS]

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
The following groups are read: mysqld server mysqld-5.6
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit.
--no-defaults Don't read default options from any option file,
                        except for login file.
--defaults-file=# Only read default options from the given file #.
--default...

Read more...

Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :
Download full text (3.2 KiB)

Able to reproduce with PS 5.5.40

root@Dell-XPS:/home/nilnandan/sandboxes/msb_5_5_40/data# /home/nilnandan/Downloads/5.5.40/bin/mysqld --defaults-file=/home/nilnandan/sandboxes/msb_5_5_40/my.sandbox.cnf --log_bin=test --help --verbose 1>&-
141217 15:29:09 [Note] Plugin 'FEDERATED' is disabled.
root@Dell-XPS:/home/nilnandan/sandboxes/msb_5_5_40/data#
root@Dell-XPS:/home/nilnandan/sandboxes/msb_5_5_40/data# ll
total 536812
drwx------ 6 nilnandan nilnandan 4096 Dec 17 15:29 ./
drwxrwxr-x 4 nilnandan nilnandan 4096 Dec 17 13:27 ../
-rw-rw---- 1 nilnandan nilnandan 538968064 Dec 17 15:27 ibdata1
-rw-rw---- 1 nilnandan nilnandan 5242880 Dec 17 15:27 ib_logfile0
-rw-rw---- 1 nilnandan nilnandan 5242880 Dec 17 15:27 ib_logfile1
-rw-rw---- 1 nilnandan nilnandan 74 Dec 17 15:27 master.info
-rw-r----- 1 nilnandan nilnandan 15423 Dec 17 15:27 msandbox.err
drwx------ 2 nilnandan nilnandan 12288 Dec 3 12:24 mysql/
-rw-rw---- 1 nilnandan nilnandan 126 Dec 17 15:27 mysql_sandbox5540-relay-bin.000006
-rw-rw---- 1 nilnandan nilnandan 37 Dec 17 15:27 mysql_sandbox5540-relay-bin.index
drwx------ 2 nilnandan nilnandan 4096 Dec 17 13:38 njoshi/
drwx------ 2 nilnandan nilnandan 4096 Dec 3 12:24 performance_schema/
-rw-rw---- 1 nilnandan nilnandan 64 Dec 17 15:27 relay-log.info
drwx------ 2 nilnandan nilnandan 4096 Dec 3 12:24 test/
-rw-rw---- 1 nilnandan nilnandan 98304 Dec 17 15:29 test.index
root@Dell-XPS:/home/nilnandan/sandboxes/msb_5_5_40/data# cat test.index
/home/nilnandan/Downloads/5.5.40/bin/mysqld Ver 5.5.40-36.1-log for Linux on x86_64 (Percona Server (GPL), Release 36.1, Revision 707)
Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Starts the MySQL database server.

Usage: /home/nilnandan/Downloads/5.5.40/bin/mysqld [OPTIONS]

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/Percona-Server-5.5.40-rel36.1-707.Linux.x86_64/etc/my.cnf ~/.my.cnf
The following groups are read: mysqld server mysqld-5.5
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit.
--no-defaults Don't read default options from any option file.
--defaults-file=# Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.

  --abort-slave-event-count=#
                      Option used by mysql-test for debugging and testing of
                      replication.
  --allow-suspicious-udfs
                      Allows use of UDFs consisting of only one symbol xxx()
                      without corresponding xxx_init() or xxx_deinit(). That
                      also means that one can load any function from any
                      library, for example exit() from libc.so
  -a, --ansi Use ANSI SQL syntax instead of MySQL syntax. This mode
                      will also set tra...

Read more...

Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :
Download full text (3.4 KiB)

Verified with PS 5.1 too.

root@Dell-XPS:/home/nilnandan/sandboxes/msb_5_1_56/data# /home/nilnandan/Downloads/5.1.56/libexec/mysqld --defaults-file=/home/nilnandan/sandboxes/msb_5_1_56/my.sandbox.cnf --log_bin=test --help --verbose 1>&-
141217 15:34:41 [Note] Flashcache bypass: disabled
141217 15:34:41 [Note] Flashcache setup error is : ioctl failed

141217 15:34:41 [Note] Plugin 'FEDERATED' is disabled.
root@Dell-XPS:/home/nilnandan/sandboxes/msb_5_1_56/data# ll
total 20792
drwx------ 4 nilnandan nilnandan 4096 Dec 17 15:34 ./
drwxrwxr-x 4 nilnandan nilnandan 4096 Dec 17 15:32 ../
-rw-rw---- 1 nilnandan nilnandan 10485760 Nov 19 16:06 ibdata1
-rw-rw---- 1 nilnandan nilnandan 5242880 Nov 19 16:06 ib_logfile0
-rw-rw---- 1 nilnandan nilnandan 5242880 Nov 19 16:00 ib_logfile1
-rw-rw---- 1 nilnandan nilnandan 6096 Dec 17 15:33 msandbox.err
drwx------ 2 nilnandan nilnandan 12288 Nov 19 15:59 mysql/
-rw-rw---- 1 nilnandan nilnandan 125 Dec 17 15:33 mysql-bin.000001
-rw-rw---- 1 nilnandan nilnandan 147475 Dec 17 15:34 mysql-bin.index
drwx------ 2 nilnandan nilnandan 4096 Nov 19 15:59 test/
-rw-rw---- 1 nilnandan nilnandan 73728 Dec 17 15:34 test.index
root@Dell-XPS:/home/nilnandan/sandboxes/msb_5_1_56/data# cat test.index | more
/home/nilnandan/Downloads/5.1.56/libexec/mysqld Ver 5.1.56rel12.7-log for unknown-linux-gnu on x86_64 (Percona Server with XtraDB (GPL), Relea
se rel12.7, Revision 228)
Copyright (C) 2000-2008 MySQL AB, by Monty and others.
Copyright (C) 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Starts the MySQL database server.

Usage: /home/nilnandan/Downloads/5.1.56/libexec/mysqld [OPTIONS]

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/Percona-Server-5.1.56-rel12.7-228.Linux.x86_64/etc/my.cnf ~/.my.cnf
The following groups are read: mysqld server mysqld-5.1
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit.
--no-defaults Don't read default options from any option file.
--defaults-file=# Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.

  --abort-slave-event-count=#
                      Option used by mysql-test for debugging and testing of
                      replication.
  --allow-suspicious-udfs
                      Allows use of UDFs consisting of only one symbol xxx()
                      without corresponding xxx_init() or xxx_deinit(). That
                      also means that one can load any function from any
                      library, for example exit() from libc.so
  -a, --ansi Use ANSI SQL syntax instead of MySQL syntax. This mode
                      will also set transaction isolation level 'serializable'.
  --auto-increment-increment[=#]
                      Auto-increment columns are incremented by this.
  --auto-increment-offset[=#]
                      Offset added to Auto-increment columns. Used when
           ...

Read more...

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Upstream?

Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :
tags: added: upstream
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1593

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.