[MDEV-6428] [PATCH] MariaDB start script doesn't realize failure of MariaDB startup Created: 2014-07-08  Updated: 2014-07-28  Resolved: 2014-07-28

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.12
Fix Version/s: 5.5.39, 10.0.13

Type: Bug Priority: Minor
Reporter: Seunguck Lee Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

Linux testhost 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux



 Description   

Startup script(support-files/mysql.server) does not realize failure of MariaDB startup. So Startup script waiting for $service_startup_timeout.

[root@testhost mysql]# service mysql start
Starting MySQL...........................................................................................................................................................................................^C

This startup script call wait_for_ready() function after starting mysqld_safe.
But mysqld process terminated before wait_for_ready() function is check the mysql server.
So wait_for_ready() function loop during $service_startup_timeout seconds in spite of mysqld already terminated.



 Comments   
Comment by Elena Stepanova [ 2014-07-08 ]

Hi,

Are you willing to propose a patch for this?

Comment by Seunguck Lee [ 2014-07-08 ]

Hi Elena.

You already have known this. (I think) ^^.

I don't know much about why MariaDB team changed original wait_for_pid to wait_for_ready.
Anyway, What do you think about just checking existence of angel-process(mysqld_safe) together ?

below snippet is "wait_for_ready" function I have changed.

wait_for_ready () {
 
  i=0
  while test $i -ne $service_startup_timeout ; do
 
    if $bindir/mysqladmin ping >/dev/null 2>&1; then
      log_success_msg
      return 0
    fi
 
    echo $echo_n ".$echo_c"
    i=`expr $i + 1`
    sleep 1
 
    ## Check whether mysqld_safe is still alive
    if ! pgrep -P $$ >/dev/null 2>&1; then
      ## If mysqld_safe process not exist, we assume starting mysqld failed
      break
    fi
 
  done
 
  log_failure_msg
  return 1
}

Thanks.

Comment by Elena Stepanova [ 2014-07-15 ]

I don't know much about why MariaDB team changed original wait_for_pid to wait_for_ready.

It was done in scope of MDEV-5580. Here is the change:
http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/4085

Comment by Seunguck Lee [ 2014-07-16 ]

Hi Elena.

Then I think checking both of mysqldadmin ping and mysqld_safe process will be working.

Thanks.

Comment by Sergei Golubchik [ 2014-07-27 ]

Thanks for the idea. I've applied a slightly different patch:

+    if kill -0 $! 2>/dev/null ; then
+      :  # mysqld_safe is still running
+    else
+      # mysqld_safe is no longer running, abort the wait loop
+      break
+    fi

mainly to avoid using new tools and constructs in the script. Because pgrep -P and if ! are not used in mysql.server yet, but kill -0 is already there, so I didn't add any new potential compatibility issues by reusing it.

Generated at Thu Feb 08 07:11:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.