Bug #65654 MySQL proxy throws an error - Not a valid Win32 Application
Submitted: 18 Jun 2012 11:30 Modified: 3 Jul 2012 19:12
Reporter: Mahesh Patil Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Proxy Severity:S1 (Critical)
Version:0.8.2 OS:Microsoft Windows (XP -32 bit)
Assigned to: CPU Architecture:Any

[18 Jun 2012 11:30] Mahesh Patil
Description:
MySQL proxy v0.8.2 (alpha) does not work on Windows XP
I have downloaded and installed Microsoft VC++ 2008 redistributable service pack 1 from given link as well.

Throws an error: mysql-proxy.exe is not a valid Win32 application.

C:\mysql-proxy\bin>mysql-proxy.exe --proxy-address=192.168.1.62:4045
 --proxy-backend-addresses=192.168.1.62:3320
mysql-proxy.exe is not a valid Win32 application.
Access is denied.

How to repeat:
Just run Proxy on command prompt:

C:\mysql-proxy\bin>mysql-proxy.exe --proxy-address=192.168.1.62:4045
 --proxy-backend-addresses=192.168.1.62:3320

Suggested fix:
Please fix on priority
[18 Jun 2012 11:31] Mahesh Patil
proxy-error

Attachment: proxy-error.JPG (image/jpeg, text), 83.35 KiB.

[18 Jun 2012 11:31] Mahesh Patil
Installed VC++ 2008 redistributable

Attachment: MS VC++2008_redistributable.JPG (image/jpeg, text), 32.57 KiB.

[18 Jun 2012 13:02] Mahesh Patil
Using Windows XP version 2002 Service Pack3
[18 Jun 2012 13:05] Valeriy Kravchuk
Please, specify exact URL you had used to download Proxy. Maybe you are just trying to run 64-bit binary on 32-bit Windows?
[18 Jun 2012 13:12] Mahesh Patil
I have downloaded mysql-proxy-0.8.2-win32-x86
From a link http://dev.mysql.com/get/Downloads/MySQL-Proxy/mysql-proxy-0.8.2-win32-x86.zip/from/http:/...
[18 Jun 2012 14:08] Valeriy Kravchuk
You are right, I have similar problem on 32-bit Windows XP:

C:\Program Files\MySQL\mysql-proxy-0.8.2-win32-x86\bin>mysql-proxy.exe --help
The system cannot execute the specified program.

C:\Program Files\MySQL\mysql-proxy-0.8.2-win32-x86\bin>ver

Microsoft Windows XP [Version 5.1.2600]

With proxy downloaded from 

http://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-Proxy/mysql-proxy-0.8.2-win32-x86.zip
[18 Jun 2012 14:22] Valeriy Kravchuk
This is what I see in Event Viewer/System:

Generate Activation Context failed for C:\Program Files\MySQL\mysql-proxy-0.8.2-win32-x86\bin\mysql-proxy.exe. Reference error message: The operation completed successfully.
.

Resolve Partial Assembly failed for Microsoft.VC90.CRT. Reference error message: The referenced assembly is not installed on your system.
.

Dependent Assembly Microsoft.VC90.CRT could not be found and Last Error was The referenced assembly is not installed on your system.
[18 Jun 2012 14:34] Valeriy Kravchuk
I have 

Microsoft Visual C++ 2005 Redistributable
Microsoft Visual C++ 2010 x86 Redistributable - 10.0.30319

installed. I'd expect that last one to cover all the needs, but will try to download exact one referred to in the manual later.
[18 Jun 2012 14:43] Valeriy Kravchuk
Now I had installed that required version:

Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161

and everything works:

C:\Program Files\MySQL\mysql-proxy-0.8.2-win32-x86\bin>mysql-proxy.exe --version

mysql-proxy 0.8.2
  chassis: mysql-proxy 0.8.2
  glib2: 2.16.6
  libevent: 1.4.12-stable
  LUA: Lua 5.1.2
    package.path: C:\Program Files\MySQL\mysql-proxy-0.8.2-win32-x86\lib\mysql-p
roxy\lua\?.lua
    package.cpath: C:\Program Files\MySQL\mysql-proxy-0.8.2-win32-x86\bin\lua-?.
dll
-- modules
  proxy: 0.8.2  

So, in my case it was really missing redistributable package. Please, check Event Viewer in your case.
[18 Jun 2012 18:18] Peter Laursen
Mahehh (he is my colleague) already told that he had VC++ 2008 redistributable installed.  But not necessarily 2005 and 1010 versions.

So maybe VC++ 2008 redistributable alone is not enough? 

Maybe you could tell the Visual Studio version where proxy 0.82 is compiled?  If it is VS 2010 I think that *also* VC++ 2010 would be required.

I will ask Mahesh to install 2010 version and/or 2005 version. You (@valeriy) should then do same exercise so that we can have docs updated with exact and correct requirements.
[19 Jun 2012 5:53] Mahesh Patil
I have exact version installed as you have mentioned.

Microsoft VC++ 2008 Redistributable - x86 9.0.30729.6161 
also I have 
Microsoft VC++ 2010 x86 Runtime - 10.0.30319
and Microsoft Visual Studio 2010 Professional-ENU

Still getting same error 
D:\MySQL-proxy\mysql-proxy\bin>mysql-proxy.exe --version
mysql-proxy.exe is not a valid Win32 application.
[20 Jun 2012 5:43] Mahesh Patil
Also I have now installed 
Microsoft VC++ 2010 Redistributable -10.0.30319

but still the same error :-(
[21 Jun 2012 8:44] Valeriy Kravchuk
What exact messages do you get in Event Viewer/System when starting mysql-proxy.exe?
[21 Jun 2012 9:07] Mahesh Patil
Unfortunately nothing has been logged in Event Viewer
Control Panel --> Administrative tools --> Event Viewer (Application and System section)
[22 Jun 2012 19:16] Sveta Smirnova
Thank you for the feedback.

Please check if this is not duplicate of bug #65023
[26 Jun 2012 6:05] Mahesh Patil
I do not think it's a duplicate of this issue http://bugs.mysql.com/bug.php?id=65023

In my case I am getting not a valid Win32 application and proxy does not try to start at all whereas in other bug report proxy program crashes with some dll dependencies also environment differs I am using Windows XP service pack 3.
[1 Jul 2012 11:09] Valeriy Kravchuk
Please, check if MD5 checksum for your binary used is the same as listed at http://dev.mysql.com/downloads/mysql-proxy/.
[2 Jul 2012 5:26] Mahesh Patil
I have downloaded again (mysql-proxy-0.8.2-win32-x86.zip)
MD5: dc98cd302dd127abbf8543f8d37aaa3f 
http://dev.mysql.com/get/Downloads/MySQL-Proxy/mysql-proxy-0.8.2-win32-x86.zip/from/http:/...

And seems to be working fine now, I meant no such error like "Not a Valid Win-32 application".

I think you can close this ticket now, but I do not know what went wrong initially.