Intermittent MySQL Connection Error in Azure Website - mysql

I'm getting the following error intermittently when making a call from my ASP.Net MVC web application which is using Dapper to query MySQL.
Unable to connect to any of the specified MySQL hosts.
The exception only occurs when my web app is published to Azure. It has worked 100% of the time when I run the code locally. I've deployed the code to a second azure website, and also get the exception there, again intermittently.
The MySQL database is running on an Azure VM (Ubuntu). This server also has some R scripts that access the database, which are being run at a set interval. I've had no connectivity issue with these either. It is just the .Net code that's struggling.
I've scoured the web, but don't feel like I've turned up anything of value. Most of the links have pointed to a connection string problem, but since it works intermittently that doesn't seem to fit my problem. Some links have referenced DNS issues, but I'm getting the same problem when I use the IP Address instead of the machine name for the DNS server.
I'm sure I need to track down more information, but I'm not sure where it would be. This is my first foray into using a MySQL db in this fashion, and I'm not familiar with config options or log files on that side of things. I feel similarly about Azure websites with database interactions too.
What can I try next?
Just to drive home the point about this error being intermittent, here's a screenshot from the Runscope job that's hitting the page (thus triggering the MySQL query) every 5 minutes:

I was able to fix (or perhaps "circumvent") this problem by adding the --skip-host-cache flag to our mysql configuration file. I still don't fully understand what the root of the problem is, but we haven't had any issues with MySQL connectivity from the Azure website since adding that.

Related

Azure MySQL in App: The server is not responding

I have an Application hosted in a Windows WebApp with MySQL in APP enabled.
After realizing the application wasn't responding I could see in the logs errors about MySQL not responding.
So when I try to access the PHPMyAdmin from the console (clicking on the manage button) I got this error:
I already tried to restart my application, and also stop/start but nothing works.
I already looked for other posts here and no one help me, unfortunately.
As per your screenshot error, it is expected when we are using the Free F1 tier as you can see in my below Screenshot when i tried to reproduce the same.
Later when I changed to Standard S1 SKU and tried to access the PHPMyAdmin from the console, got the expected response from server.
Create an App service.
Go to create a web app. Left-hand side menu search MySQL. and click MySQL.
Click MySQL in App and convert off to on. and click the Save button.
Then Manage Enable and click on the Manage link. phpMyAdmin open.
Solved fixing the database port.
After checking the application's logs I realized a loop of tries to connect to the database and it got all memory and cpu of the server, doing the phpMyAdmin out of the connection. So after scaling the instance and restarting the application, I realized the MySql port had changed. So the problem was because in some time the MySQL port changed generating an infinite loop in the application and in the end making phpMyAdmin out because there was no memory available in the server.

Deploying a .NET application to Google Cloud Platform worked on initial deploy, now getting 502 Error: Server Error

To give some background, I'm an (unpaid) intern, and I'm unrelated to dealing with this kind of stuff. My employers wanted to update some pictures, and they did locally but didn't know how to upload the new version to the server.
I used the publish settings that were saved in Visual Studio from when the previous intern deployed the server (he was specialized in web site stuff) and it worked on deploy ... then I refreshed the page and I'm getting 502 server error.
Steps I have taken:
Connect to the VM and restart it - didn't solve it. it's using Microsoft server 2016.
Open the VM trough RDP, check if there are errors. There were 3 services not running, and I start them manually. One still isn't running, Downloaded Maps Manager. Ok... I google it and it's not a necessary service so I disable it. Now there are no errors and all services are running but I still am getting this error.
I tried pinging the IP of the server, and the URL itself and it works.
I believe it might be something to do with the load balancer, but I had one HTML class and nothing dealing with actually publishing stuff. If you could point me in the right direction I would appreciate it. The only reason why I'm trying to fix this myself is that I didn't make some kind of backup, and I feel so stupid having taken the site down.
Edit: I've gone to "load balancing" and it says service unhealthy. I tried going to the IPs there and it brings me to the same 502 server error page. From what I've gathered this is a configuration error, it's impossible they messed something with the site itself, right? It did work that first time, and if I run it from Visual Studio it works on the local machine ...

"Arithmetic operation resulted in an overflow." getting this error in ASP.Net after converting to the Azure project

I am working on an asp.net application. Now I am working on to move it to windows azure server. After converting the project to the windows azure project it gets started to give me errors in accessing the database. I am able to access the data but the problem occurs where-ever I am selecting longblob type column and bit columns.
When running the application as normal asp.net application everything works perfectly but when I run it as the azure application from my visual studio, it starts to give "Arithmetic operation resulted in an overflow." when filling the data-table. After doing some research for this I found that this type of error occurs in when there are some special type of columns are selected in the select command. In my case the special data types are "longblob" and bit[1] in the mySQL database table.
Please suggest a solution to make this work in windows azure environment too.
This is a known issue for Hybrid Connection to access SQL server.
Please follow the temporary fix mentioned here https://blogs.msdn.microsoft.com/waws/2016/05/17/hybrid-connection-error-with-sql-server-system-overflowexception-arithmetic-operation-resulted-in-an-overflow/
I am having the same issue today as of last night. The application has not been updated in weeks. Everything I have read indicates it has something to do with using an int32 and the int being too large but the page the application is crashing on is not using an int in the code behind. I disabled all SQL on the page and it still crashes. I think this is something on the Azure side. Putting in a ticket with them. I'll keep you updated.
Here is what fixed it for me.
My Azure Web App was using the Azure Hybrid Connection to access my on-site SQL server. The server running the HCM also runs Azure Backup. One of my admins had updated the Azure Recovery Agent on that server.
After trying all sorts of things, uninstalling the most recent update to the Azure Recovery Services Agent is what resolved the issue. My Web App was able to access my on-site dbs without issue.
I had the same error when using an Azure hybrid connection with an onsite SQL Server. I did not have the Azure backup agent installed on the local server, however I did have Windows Server 2012 set to automatically update and there were a lot of updates which were pushed out on May 10 2016.
At this stage, I'm not sure which update specifically caused the problem, but I have narrowed it down to either 3146978, 3146751, 3146604, 3145384, 3144850, 3142026, 3135998, 3134179, 3125424, 3103616 or 3145432.
If you're running into issues with Azure Hybrid Connections, try uninstalling KB3142036 from the server which runs the Hybrid Connection Manager. Seems to have solved the SQL Server connection issues for me.

Trying to get a local MySQL database to work with GAE development server

Soo, I've decided to toy around a bit with GAE. Most of my previous experience with developing web-applications is with ASP.Net, so this java / eclipse-world is kinda unfamiliar to me.
I read around, and found out that I can configure my project to use a Google Cloud SQL instance when it's deployed at Google, while using a local MySQL database while running locally on my development server.
The problem I ran in to now is that I can simply not press "Ok" in the eclipse dialog for configuring my local MySQL database? Well - I can, but with no result. No error message, no window close, no nothing.
I'm not really sure what I am doing wrong, but was hoping some wiz in here who has more experience than me with GAE have had a similar problem and a solution?
I've attached a picture of my local MySQL configuration:
http://imgur.com/0tjK7Sf
Thanks in advance

SQL Component Connection issue in IDE

Good evening guys.
I'm currently trying to get started on development of a project to make my own life a little easier. Essentially, i want to connect to a MySQL database running on a remote server, and then go from there with a few various options for usage. The database in question is used for a Joomla! installation, and my focus will primarily be managing articles from a desktop application (as opposed to using the administrator backend on the website).
I've allowed my own host access to the remote servers (via the CPanel web interface used by my hosting provider), and ensured that LIBMYSQL.dll is inside the RAD Studio\9.0\bin folder and again inside my executables folder (so as to avoid any of the issues related to being unable to init. the driver). I've connected to the server successfully by using MySQL Workbench and can freely query the table. Now, onto the problem.
This is my first database application so please understand that a simplified or excessive explanation may be needed
I'm having issues setting some of the component properties at design time. I've got a TSQLConnection component, a TSQLDataSet component, and a TSQLTable component. I've set up the server properties in TSQLConnection to work with my server.
However, if i try to retrieve anything from the database inside the Delphi XE2 IDE (i.e. the login prompt appears) such as changing Active property to true, i get a Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061) error (where 'x' relates to part of my servers IP).
If i run the application itself though, and then click on the "connect" button i've got on the interface, it connects fine with no errors. I added ShowMessage routines to the AfterConnect, AfterDisconnect, and OnLogin events of TSQLConnection to verify it was actually going through, and all of them functioned as i'd expect when successful. As i've not coded for it to do anything outside of that (due to still learning the basics), there's no data visible on the interface for me to work with, but the connection at least appears to be there.
To clarify, i can connect from the application i developed (as well as from MySQL Workbench, but not from within the Delphi IDE itself.
So, where am i going wrong with this?
I'm guessing it's probably some oversight by myself due to my lack of knowledge on the subject of databases, but i'm very keen to expand out of the desktop environment and start working with some more areas of the IT world (without losing the development side of things that i enjoy so much).
As #SertacAkyuz pointed out in the original comments, it was indeed an issue related to my connection, specifically Firewall settings. I had assumed that "Connection Refused" was related to the connection attempt being made, but being actively refused by the remote server. The more you know.