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

mysqld_safe errors are lost when executed from the init script and additional arguments are not passed in case of a "restart" on Debian

    XMLWordPrintable

Details

    Description

      When mysqld_safe is exeuted by the init script and fails with an error message sent on stderr, the message will neither be displayed nor logged :

      # mysqld_safe --malloc-lib=test1234
      140326 16:13:38 mysqld_safe --malloc-lib must be an absolute path or 'tcmalloc';  ignoring value 'test1234'

      # /etc/init.d/mysql start --malloc-lib=test1234                                                                                     
      Starting MariaDB database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!

      There is no mention of the error throwed by mysqld_safe on the mysql error log or on the syslog, it fails and the only way to know why it failed is to manually launch mysqld_safe on foreground.

      Another issue, is that calling the init script with "restart" wont pass the additional arguments as it does when calling it with "start" (this issue exists on the Debian/Ubuntu packages init script but not on support-files/mysql.server) :

      # /etc/init.d/mysql restart --malloc-lib=test1234                                                                                   
      Stopping MariaDB database server: mysqld.
      Starting MariaDB database server: mysqld . ..
      Checking for corrupt, not cleanly closed and upgrade needing tables..

      (while it should fail)

      Here is a simple patch for both issues for the Debian/Ubuntu init script that will send the mysqld_safe stderr to syslog (but it will keep a logger process running, solving that on mysqld_safe itself if possible should be better) and keep the additional arguments when using the "restart" command (which is already working on the non-packaged init that pass the $other_args variable) :

      --- /etc/init.d/mysql	2014-03-26 16:30:29.786052516 +0100
      +++ /etc/init.d/mysql	2014-03-26 16:19:55.316198723 +0100
      @@ -106,7 +106,7 @@
       	    test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld
       
       	    # Start MariaDB!
      -  	    /usr/bin/mysqld_safe "${@:2}" > /dev/null 2>&1 &
      +  	    /usr/bin/mysqld_safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER &
       
       	    # 6s was reported in #352070 to be too few when using ndbcluster
       	    for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do
      @@ -161,7 +161,8 @@
       
         'restart')
       	set +e; $SELF stop; set -e
      -	$SELF start 
      +	shift
      +	$SELF start "${@}"
       	;;
       
         'reload'|'force-reload')

      After having applied the patch :

      # /etc/init.d/mysql restart --malloc-lib=test1234
      [ ok ] Stopping MariaDB database server: mysqld.
      [FAIL] Starting MariaDB database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!

      And we can find this line on the syslog :

      Mar 26 17:18:48 server /etc/init.d/mysql[22154]: 145326 17:18:48 mysqld_safe --malloc-lib must be an absolute path or 'tcmalloc';  ignoring value 'test1234'

      Attachments

        Issue Links

          Activity

            People

              otto Otto Kekäläinen
              jb-boin Jean Weisbuch
              Votes:
              1 Vote for this issue
              Watchers:
              6 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.