Bug #50585 WB is not recognizing the correct status of the server
Submitted: 25 Jan 2010 10:43 Modified: 3 Jun 2010 21:20
Reporter: Albrecht Backhaus Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.14, 5.2.15, 5.2.16, 5.2.17, 5.2.19, 5.2.20, RC2 OS:Windows (win7 x64)
Assigned to: Alfredo Kojima CPU Architecture:Any

[25 Jan 2010 10:43] Albrecht Backhaus
Description:
I am running mysql server x64 on thet machine. WB does not recognize that the server is running though he is.

How to repeat:
Install mysql server 5.1 x64 on win7 x64 and start the service. Insatll latest WB 5.2.14. beta and add the server as an instance to the admin panel. switch to that instance and look at the status. it is constantly reporting that the server in not running.
[25 Jan 2010 14:25] Johannes Taxacher
Hello Albrecht,

are you running your server as a windows service? what's the service name?
Workbench uses a the commandline program sc to query the status of the service. by default we look for a servicename called 'mysql'. if you are using a different servicename, you'd have to adapt this command to suit your setup. This can be found in the administration profile, on the tab "system Profile" "MySQL Management" enter the command to detect the presence of a running server in the textbox next to "Chack MySQL Status".
[25 Jan 2010 15:54] Albrecht Backhaus
Hello Johannes,

I checked the service name in the admin panel carefully against the windows service entry before posting the bug. 
When I copy the command from the admin panel into a command shell it works properly. 

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Windows\system32>sc query mysql |  findstr RUNNING
        STATE              : 4  RUNNING

But WB doesn't recognize it.
[25 Jan 2010 16:18] Valeriy Kravchuk
I do not have this problem on 64-bit XP. Server status is displayed correctly. Maybe have something to do with permissions?
[25 Jan 2010 16:36] Albrecht Backhaus
I run wb with admin rights - no effect - I am using win7 x64 not XP
[25 Jan 2010 22:02] MySQL Verification Team
I couldn't repeat on Windows Vista Ultimate X64 SP2 too.
[26 Jan 2010 7:05] Albrecht Backhaus
- The local mysql server (x64) is up and running. Checked this more that twice
- I checked the wb config in the admin panel for the proper service name - ok.
- I ran the command from the "Check MySQL Status" field in the os command shell. It is running with out error - returning the proper status "4 RUNNING".
- WB still reports "Server is stopped" which is wrong.

My installation of server and wb is right out of the box - no complex environment or operation conditions. 

OS: Microsoft Windows 7 Ultimate
Version	6.1.7600 Build 7600
Systemtype: x64-based PC
Processor : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
RAM:8,00 GB
MySQL Server 5.1.42 (x64)
WB 5.2.14

I can provide remote access to that machine for somebody willing to see the problem and to check the conditions. Send me a message if anybody is interested.

Any advice to solve this problem is very much appreciated.
[1 Feb 2010 17:45] MySQL Verification Team
Could you please try version 5.2.15. Thanks in advance.
[2 Feb 2010 7:30] Albrecht Backhaus
Hello,

I tried the latest beta 5.2.15 - problem still exists
[17 Feb 2010 11:11] Maksym Yehorov
Albrecht,
We rely on OS execution code for detection status of the server. So command sc query mysql |  findstr RUNNING must return 0 in case findstr found RUNNING in the output of sc query mysql. Unfortunately we can not always reliably detect the execution status in Windows. So the detection script was updated to sc query mysql | wba_filter(RUNNING). These scripts can be updated either manually, or by selecting different platform and selecting back to windows.
Also please note that sc query ..... is case-sensitive.

Please, can you try replacing status command to sc query MySQL | wba_filter(RUNNING) and tell us if that helps.
[17 Feb 2010 14:14] Albrecht Backhaus
Maksym,

I tried your suggestion with "sc query mysql | wba_filter(RUNNING)" - the problem still exists. Server is up and running and WB says "not running".

The command "sc query mysql | findstr RUNNING" executed as admin in the os console screen returns 

"C:\Windows\system32>sc query mysql |findstr RUNNING
        STATE              : 4  RUNNING"
[20 Feb 2010 9:50] Albrecht Backhaus
Hello,

I tried the latest beta build now and the problem still exists. The server is reported as stopped though it is up and running. I made a clean install of 5.2.16 (deinstall of the previous builds instead of simply updating).

I tried the newly implemented filter testing facility and got the following:

The "sc query mysql" results at the os console are :

C:\Windows\system32>sc query  mysql

SERVICE_NAME: mysql
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

I copied this into the input windows and "wba_filter(RUNNING)" into the filter condition field. The output was:

   7 '        STATE              : 4  RUNNING' -> '        STATE              : 4  RUNNING'. cur_code = 0

   8 '                                (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)' -> ''. cur_code = 1

   9 '        WIN32_EXIT_CODE    : 0  (0x0)' -> ''. cur_code = 1

   10 '        SERVICE_EXIT_CODE  : 0  (0x0)' -> ''. cur_code = 1

   11 '        CHECKPOINT         : 0x0' -> ''. cur_code = 1

   12 '        WAIT_HINT          : 0x0' -> ''. cur_code = 1

   13 '' -> ''. cur_code = 1

   14 'C:\Windows\system32>' -> ''. cur_code = 1

wba_filter exec code = 0

-------------

Filtered text:

        STATE              : 4  RUNNING

Filters execution code = 0

===================

retcode = 0

Though getting an exec code of 0,  WB is reporting the server as stopped. 

Any ideas ?
[20 Feb 2010 10:46] Albrecht Backhaus
corrected typo in Synopsis
[1 Mar 2010 15:49] Maksym Yehorov
Found and fixed bug.
[24 Mar 2010 9:45] Johannes Taxacher
fix confirmed in repository
[25 Mar 2010 16:09] Tony Bedford
An entry has been added to the 5.2.17 changelog:

MySQL Workbench reported a server as not running, even though the server was correctly running. MySQL Server concerned was running on Windows 7, 64-bit.
[4 Apr 2010 9:50] Albrecht Backhaus
Was so glad to see that this bug seemed to be found...

Installed the latest beta today and added a fresh instance to the admin panel. 
During this steps I encountered the following:

Checking command 'sc query mysql | wba_filter(RUNNING)'
Server detected as stopped
Unable to determine codepage from local shell: x64 on x64Unable to fetch ProgramFiles value in local Windows machine: Unable to fetch ProgramFiles(x86) value in local Windows machine: Check if %ProgramFiles(x86)%\MySQL\MySQL Server 5.1\my.ini exists locally
Operation failed: File %ProgramFiles(x86)%\MySQL\MySQL Server 5.1\my.ini doesn't exist
Checking command 'sc query mysql | wba_filter(RUNNING)'
Server detected as stopped
Unable to determine codepage from local shell: x64 on x64Unable to fetch ProgramFiles value in local Windows machine: Unable to fetch ProgramFiles(x86) value in local Windows machine: Check if %ProgramFiles%\MySQL\MySQL Server 5.1\my.ini exists locally
Operation failed: File %ProgramFiles%\MySQL\MySQL Server 5.1\my.ini doesn't exist

I pointed manually to the my.ini file which in fact is at the location shown in the error message above ??

WB still reports the server as unknown and as being stopped though it is running - same as before. When checking the new option "Aquire admin right when checking status" wb is running in an infinite loop of asking for permission through UAC. 

Rather disappointing ... 

any constructive and helpful tips/advice what to do ?
[5 Apr 2010 11:25] Maksym Yehorov
Albrecht,

can you add environment variable DEBUG_ADMIN=5, run WB and attach the output to this bug report?
[10 Apr 2010 17:17] Albrecht Backhaus
Maksym: 

I set the ENV variable and have no idea where wb is storing the files on my machine. Can't find any docs about this.?
[12 Apr 2010 8:57] Maksym Yehorov
The extra log output should be routed to the WB's output tab (Ctrl-F2).
[12 Apr 2010 9:21] Albrecht Backhaus
Extra log output as requested

Attachment: output.txt (text/plain), 8.22 KiB.

[12 Apr 2010 9:22] Albrecht Backhaus
I attached the output as reqeusted
[14 Apr 2010 3:23] Leonardo Rodriguez
I am having the same issue as Albrecht. 
It looks like the issue is with:  wba_filter(RUNNING) 

This function seems to be parsing the output of the "sc query mysql" command incorrectly. I would offer to fix the issue, but don't even know where to start. Look at the workbench source perhaps? I wonder if we could just hardcode some value in the "Check MySQL Status:" input field, instead of "sc query mysql | wba_filter(RUNNING)"
[14 Apr 2010 7:13] Louis Breda van
Hello,

I am trying to use the WB for a couple of month now running vista 64, but never managed. However we are comming closer all the time.

I think one of the last blokking issues is the issue described here. 
I just noticed exactly the same problem.

Futher on please extend the WB-profiles with 5.5 profiles. My version below.

Louis

<?xml version="1.0"?>

<data>
    <value type="dict">
    <value type="string" key="sys.config.path">C:\Program Files\MySQL\MySQL Server 5.5\my.ini</value>
    <value type="string" key="sys.config.section">mysqld</value>
      
    <value type="string" key="sys.mysqld.start">sc start mysql</value>
    <value type="string" key="sys.mysqld.stop">sc stop mysql</value>
    <value type="string" key="sys.mysqld.status">sc query mysql | wba_filter(RUNNING)</value>
    <value type="int" key="sys.usesudo">1</value>

    <value type="string" key="sys.system">Windows</value>
    <value type="string" key="serverVersion">5.5</value>
  </value>
</data>

!! not working, due to I assume the wba_filter problem !!
[22 Apr 2010 13:14] Albrecht Backhaus
tried latest beta (9) ....

... still not working ....  :-(
[1 May 2010 15:54] Albrecht Backhaus
latest beta _ problem still exists
[1 May 2010 16:02] Albrecht Backhaus
Haven't seen any progress on this issue for a long time nor was there any reaction/information about what is going on by the dev team.

Maybe that I am wrong - but the feature that WB is able to recognize properly if the server is running or not - from my point of view isn't the last priority for an admin tool. 

Most disappointing isn't so much the existence of that bug, but the obvious lack of attention and communication which is paid to it - but maybe that I am wrong with this too ...
[3 May 2010 18:07] Curt VanCalster
I am having same issue, trying to create a server connection under server administration and keep getting the same error as described above.  Any fixes established for this?
[9 May 2010 16:36] John Nelson
I had this problem as well.  My version of MySQL workbench is 5.2.20.  I am running on Windows 7 Home Premium, 64 bit.  My fix was to change the server status detection to the following:

sc query mysql | findstr "RUNNING"

This works perfectly for me.
[12 May 2010 0:04] Leonardo Rodriguez
John,

I have tried your suggestion, still not working. Running Windows 7 64 bit...
[12 May 2010 20:28] Louis Breda van
Hello,

I just checked 5.2.21 RC. Despite that it is a RC it still does not recognise the running server.

It is a pity, :<

Louis
[13 May 2010 16:53] Alfredo Kojima
Please paste the output of the chcp command (without any args). What language is your Windows in?
[13 May 2010 17:00] Alfredo Kojima
If anyone has 1h or so to spare for helping track the issue, please join the #workbench IRC channel in irc.freenode.net  Thank you.
[13 May 2010 18:41] Albrecht Backhaus
Alfredo: 

I already offered any help and support, including remote reading access to my machine to see the problem live, for fixing this issue right at the beginning of this thread. Seemed that there was no interest in this offer at that time. 

I now renew my offer - by interest I can be reached via mail to agreee on a suitable date and time
[14 May 2010 9:25] Greg Thomas
I'm am seeing a similar problem; with a Win32 WB client (version 5.2.21) talking to a Win32 MySQL server (Windows 2003 running a Cygwin based SSH server) - more details at http://bugs.mysql.com/bug.php?id=51332 which has been closed as a duplicate of this bug. 

I'll attach the details log that I'm seeing.
[14 May 2010 9:26] Greg Thomas
The output log when accessing a Win32 server over SSH

Attachment: output.txt (text/plain), 9.16 KiB.

[14 May 2010 9:29] Greg Thomas
For some reason, it appears from the output.txt that there is no output from running the command;

wb_admin_ssh.py:exec_cmd():350 SSH.exec_cmd(cmd = cmd.exe /C "sc query mysql " , output =  . Retcode = -1 )
wb_admin_control_be.py:exec_cmd():998 execute:  sc query mysql   =  
wb_admin_control_be.py:exec_cmd():1007 Execute: sc query mysql  , retcode = -1 , result[1] = -1  filters_code = 1

Yes, if I run the exact same command manually, it works just fine ...

$ ssh xxxxxx@yyyyy cmd.exe /C "sc query mysql "
802938884@bssd-server's password:

SERVICE_NAME: mysql
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

Though it does at least correctly determine right code page (850).
[14 May 2010 19:34] Alfredo Kojima
Was able to determine cause and a possible fix with help from Albrecht.
[14 May 2010 19:55] Alfredo Kojima
Greg In the instance editor, try replacing sc with the full path to it, like
c:\windows\system32\sc.exe
[15 May 2010 1:22] Leonardo Rodriguez
The last suggestion made the trick:

c:\windows\system32\sc.exe query mysql | wba_filter(RUNNING)

Thanks a lot gentlemen.
[15 May 2010 3:34] Alfredo Kojima
Leonardo, can you check if putting just sc.exe without the rest of the path works?
[15 May 2010 10:24] Louis Breda van
Hello,

I did some test related to the sc path discussion.

To start with "It does NOT solve the problem for me!"

Some findings:
- c:\windows\system32\ is not a standard path so you need "c:\windows\system32\sc"
- from the commandline findstr "RUNNING" works and wba_filter(RUNNING) NOT
- wba_filter is as expected an unkown command
- if wba_filter is a necessary MySQL specific util, please also include the full path there 
- I could not find a wba_filter executable
- the workbench does have a manage server system profile tab where you can defind the command "Check MySQL status" and the same is defined in the profile file xml file (I do not like the Idee of that file, certainly not if it is double).
- what ever I did some trails which path and wba_filter versus findstr variants. Non of them worked !!!! (vista64, 5.5.3 64 bit server)

Sincerely  

Louis
[15 May 2010 11:05] Louis Breda van
For info here the screengrep to show there is still beside the path another problem:

2010-05-15 12:44:13 - Checked server status: Server is stopped.
2010-05-15 12:44:13 - Server is stopped
2010-05-15 12:44:15 - Checking server status...
2010-05-15 12:44:15 - Executing: dows\system32\sc query mysql | findstr "RUNNING"
2010-05-15 12:44:15 - Check Output:  (1)
2010-05-15 12:44:15 - Checked server status: Server is stopped.

Server is running

2010-05-15 13:00:26 - Checked server status: Server is stopped.
2010-05-15 13:00:26 - Server is stopped
2010-05-15 13:00:28 - Checking server status...
2010-05-15 13:00:28 - Executing: dows\system32\sc query mysql | wba_filter(RUNNING)
2010-05-15 13:00:28 - Check Output:  (1)
2010-05-15 13:00:28 - Checked server status: Server is stopped.

Louis
[15 May 2010 11:11] Louis Breda van
Sorry,

I made a fault when I made the screengreps. Here the correct one's

2010-05-15 13:07:13 - Checked server status: Server is stopped.
2010-05-15 13:07:14 - Server is stopped
2010-05-15 13:07:15 - Checking server status...
2010-05-15 13:07:15 - Executing: c:\windows\system32\sc query mysql | findstr "RUNNING"
2010-05-15 13:07:15 - Check Output:  (1)
2010-05-15 13:07:15 - Checked server status: Server is stopped.

2010-05-15 13:09:24 - Checked server status: Server is stopped.
2010-05-15 13:09:24 - Server is stopped
2010-05-15 13:09:26 - Checking server status...
2010-05-15 13:09:26 - Executing: c:\windows\system32\sc query mysql | wba_filter(RUNNING)
2010-05-15 13:09:26 - Check Output:  (1)
2010-05-15 13:09:26 - Checked server status: Server is stopped.

I reallity the server is running of course.

Louis
[15 May 2010 14:16] Alfredo Kojima
Louis, you need to specify the extension to the sc command:

c:\windows\system32\sc.exe   
not  
c:\windows\system32\sc

wba_filter and other commands after the | are internally handled by Workbench
[15 May 2010 14:22] Louis Breda van
Alfredo,

In my option the extension is not required. 
But I just tested it.

2010-05-15 16:20:09 - Checked server status: Server is stopped.

2010-05-15 16:20:09 - Server is stopped

2010-05-15 16:20:11 - Checking server status...
2010-05-15 16:20:11 - Executing: c:\windows\system32\sc.exe query mysql | wba_filter(RUNNING)
2010-05-15 16:20:11 - Check Output:  (1)
2010-05-15 16:20:11 - Checked server status: Server is stopped.

So, still not working,

Louis
[15 May 2010 16:43] Alfredo Kojima
There are a couple issues at play here:

- Insufficient diagnostic messages: when a command fails and prints an error message to stderr, the message is not captured and lost. 
- For some reason, some Windows machines don't contain c:\windows\system32 in PATH environment variable, making commands like cmd.exe, chcp, sc and others to not work. It would have been easy to detect that if the "no such command" error message was properly captured, but because of the 1st issue, this wasn't the case.
[17 May 2010 9:32] Greg Thomas
Specifying the full path made no real difference to me; 

wb_admin_ssh.py:exec_cmd():350 SSH.exec_cmd(cmd = cmd.exe /C "chcp" , output = Active code page: 850
 . Retcode = 0 )
wb_admin_control_be.py:exec_cmd():998 execute:  chcp  =  Active code page: 850
wb_admin_control_be.py:exec_cmd():1007 Execute: chcp , retcode = 0 , result[1] = 0  filters_code = None

[snip intermediate messages]

wb_admin_ssh.py:exec_cmd():350 SSH.exec_cmd(cmd = cmd.exe /C "c:\windows\system32\sc.exe query mysql " , output =  . Retcode = -1 )
wb_admin_control_be.py:exec_cmd():998 execute:  c:\windows\system32\sc.exe query mysql   =  
wb_admin_control_be.py:exec_cmd():1007 Execute: c:\windows\system32\sc.exe query mysql  , retcode = -1 , result[1] = -1  filters_code = 1
wb_admin_configuration.py:refresh_tasks():253 server running False , self.closing = False
wb_admin_configuration.py:refresh_tasks():255 Performing extra actions
wb_admin_configuration.py:refresh_tasks():258 Done monitor refresh

Note that it still works fine from the command line, though I did have to change forward to backslash ...

$ ssh aaa@bbb "c:\windows\system32\sc.exe query mysql"
aaa@bbb's password:
bash: c:windowssystem32sc.exe: command not found
$ ssh aaa@bbb "c:/windows/system32/sc.exe query mysql"
aaa@bbb's password:

SERVICE_NAME: mysql
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

To be sure; I tried again using c:/windows/system32/sc.exe in Workbench; no difference.
[17 May 2010 12:44] Alfredo Kojima
Can you type echo %PATH% from a shell prompt window and paste the output? If it does not contain c:\windows\system32, can you add it and retry?
[17 May 2010 13:04] Curt VanCalster
adding c:\windows\system32 to my PATH fixed me.  Thanks
[17 May 2010 13:47] Alfredo Kojima
Fixed. Also fixed Refresh button in Start/Stop section to output error messages from commands so it can be used for diagnostics.
[20 May 2010 17:01] Johannes Taxacher
fix confirmed in repository
[21 May 2010 10:48] Tony Bedford
Changed changelog entry to version 5.2.22.
[27 May 2010 18:19] Louis Breda van
Hello,

I would apriciate to have a workbench version including a fix for this problem released.

IMHO this bug is critical since, up to this very moment, every 64 bit windows owner is still not capable to use the WB.

Sincerely,

Louis
[31 May 2010 14:42] Irshad Valimamod
Hi

I was having this problem.

But I managed to solve it.

I just created a new server instance and modified some parameters:

sc start mysql5
sc stop mysql5
sc query mysql5 | wba_filter(RUNNING)

My service name is mysql5.

That's all.

Now I can start, stop and check status:

2010-05-31 16:40:10 - Checked server status: Server is stopped.
2010-05-31 16:40:10 - Server is stopped
2010-05-31 16:40:16 - Checked server status: Server is stopped.
2010-05-31 16:40:16 - Trying to start server...
2010-05-31 16:40:18 - 
2010-05-31 16:40:18 - Checked server status: Server is stopped.
2010-05-31 16:40:19 - Server is running
2010-05-31 16:40:34 - Checking server status...
2010-05-31 16:40:34 - Executing: sc query mysql5 | wba_filter(RUNNING)
2010-05-31 16:40:34 - Check Output:         STATE              : 4  RUNNING 
 (0)
2010-05-31 16:40:34 - Checked server status: Server is running.

Note:
Win Vista x86
MySQL 5.0.45
WB 5.2.21

Thanks
[3 Jun 2010 21:20] Albrecht Backhaus
Hello

I can now confirm that this bug is solved for me with RC2. Thanks.
[4 Jun 2010 11:42] Louis Breda van
Hello,

It is a pitty, but the WB still is not working properly for me (vista64 m553 server).

It does recognise the server now and can start and stop itm however there is no server health info displayed.

Still using that good old (but regretfully not supported) gui-tools. With a simple but working tray icon and in browser and administrator what (appart form bugs) just do what I like them to do.

Not that I do not like the workbench (!), but for simple all day thinks it is too complicated / too much !

Louis
[4 Jun 2010 19:02] Louis Breda van
Hello,

Since my previeus comment, I discoverd that my statement that server health does not show info is not 100% true. 

I simply do not know what is wrong. It just is not working properly.

Sometimes I see some data displayed in the "connection usage" and in the "traffic" windows (did not yet notice any thing in the other windows). 

But it only sometimes. The proces behind the graphs seems to die. Leaving a static value below the windows.

do not know, not ok

Louis
[29 Sep 2010 10:12] Thierry Beeckmans
I am having the same problem on a 32bit windows 7 system.
The installed MySQL server came with Zend Server, it's service is named MySQL_ZendServer51.

It also refuses to detect the server running.
By adjusting a line in the server_instances.xml file, changing it from "sc query mysql | wba_filter(RUNNING)" to "sc query MySQL_ZendServer51 | findstr RUNNING", I managed to bypass the problem.
[13 Oct 2010 10:15] james liang
same problem
win7 32-bit 
wb vision 5.5.29
-----------------------------
[13 Oct 2010 10:34] james liang
same problem
win7 32-bit 
wb vision 5.2.29
----------------------------------------------
2010-10-13 18:32:48 - Checking server status...
2010-10-13 18:32:48 - Executing: sc query mysql | wba_filter(RUNNING)
2010-10-13 18:32:48 - Check server: [SC] EnumQueryServicesStatus:OpenService 失败  1060:

指定的服务未安装。

2010-10-13 18:32:48 - Server check returned 1
2010-10-13 18:32:48 - Checked server status: Server is stopped.