Bug #48975 MySQL Workbench administrator does not detect server status correctly
Submitted: 23 Nov 2009 5:55 Modified: 15 Feb 2010 11:53
Reporter: Giuseppe Maxia Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S1 (Critical)
Version:5.2.8, 5.2.10 OS:Mac OS X
Assigned to: Maksym Yehorov CPU Architecture:Any
Tags: administrator, detection, server, STATUS, workbench

[23 Nov 2009 5:55] Giuseppe Maxia
Description:
When more than one MySQL server is running on the same host, the server detection fails to detect if the server is not running.

If it not running, it wrongly says that it's running. After stopping the server, it reports success on the operation, but still reports the server as running.

How to repeat:
1a. Use MySQL Sandbox to start a new server.
1b. Stop the main server
1c. Use MySQL Workbench administrator interface

2a. Start the MySQL test suite
2b. stop the main server
2c. Use MySQL Workbench administrator interface

Suggested fix:
Make Workbench detect if the server is running with the same procedure used by the mysql.server script.
Tell the users what output a start/stop script should produce (i.e. what MySQL Workbench expects to see when the server is on or off), so they can create their own scripts.
[26 Nov 2009 15:55] Johannes Taxacher
we need to document the commands/scripts WB uses for start/stop/status so users can build their own scripts
[4 Dec 2009 15:31] Alfredo Kojima
Giuseppe,

mysql.server script doesn't work for me:

kojima@Peppermint wb52$ /usr/local/mysql/support-files/mysql.server status
/usr/local/mysql/support-files/mysql.server: line 418: pidof: command not found
 ERROR! MySQL is not running

Does it work in your Mac?
[4 Dec 2009 17:53] Giuseppe Maxia
Alfredo: it works for me

$ sudo /usr/local/mysql/support-files/mysql.server status
 SUCCESS! MySQL running (18956)
$ sudo /usr/local/mysql/support-files/mysql.server stop
Shutting down MySQL
. SUCCESS! 
$ sudo /usr/local/mysql/support-files/mysql.server status
 ERROR! MySQL is not running
$ sudo /usr/local/mysql/support-files/mysql.server start
Starting MySQL
. SUCCESS! 
$ sudo /usr/local/mysql/support-files/mysql.server status
 SUCCESS! MySQL running (19077)
[4 Dec 2009 19:27] Alfredo Kojima
pidof doesn't seem to be installed in our Snow Leopard build server either.
Can you do a "type -a pidof" and see where it's coming from? I suspect it might be from something
like fink or macports.
[5 Dec 2009 9:05] Giuseppe Maxia
pidof is not installed in my box. Yet, the script works as expected. If pidof doesn't return a valid value, then the script looks for the lockfile, and uses it to determine if the server is running.
[7 Dec 2009 14:23] Giuseppe Maxia
If Workbench documents what each script should do, it would be easy for users to build their own.

For example:

* START 
  ** action : starts the server
  ** returns: 0 on success, -1 on failure
  ** prints : optional debugging info to STDOUT

* STOP 
  ** action : stops the server
  ** returns: 0 on success, -1 on failure
  ** prints : optional debugging info to STDOUT

* STATUS
  ** action : none
  ** returns: 0 on server running, 1 on server stopped, -1 on error
  ** prints : optional debugging info to STDOUT
[11 Dec 2009 13:08] Alfredo Kojima
Good point. Because even if the start/stop script works, it would help with this bug if they work on the same instance.

I'll add a small window with better description for what to put in the options and also ask it to be put
on the full WB documentation.
[28 Jan 2010 21:42] Alfredo Kojima
Changed the default command to check for status to:

ps xa | grep /usr/local/mysql/bin/[m]ysqld

This will allow distinguishing different server versions by their installation paths.
[1 Feb 2010 15:56] Johannes Taxacher
fix will be included in 5.2.16
[1 Feb 2010 16:01] Giuseppe Maxia
Would it be possible to include an explanation of what Workbench expects the scripts to return?

This way, users could create their own custom commands for starting, stopping, and querying the status.

Thanks.
[2 Feb 2010 9:08] Michael G. Zinner
Giuseppe has a valid point here. Please add a description of what means "success" and what means "failure" to the Filter Help dialog.

Currently, the dialog just states what you can use. But it does not state how to actually make it work.

Also, please add an example of how to use the filters.
[10 Feb 2010 13:08] Maksym Yehorov
Added explanation to server instance editor.
[12 Feb 2010 22:00] Johannes Taxacher
description of the commands has been added to the "filters help" dialog
[15 Feb 2010 11:53] Tony Bedford
An entry has been added to the 5.2.16 changelog:

MySQL Workbench did not correctly detect the status of MySQL Servers where multiple servers were running on the same host, and so displayed incorrect server status on the Admin screen.