this is my first question, hope I do it right!
I'm actually working on a Centos server with nginx as reverse proxy and a NextJs web application.
Until now I've made a single connection for every query to my db, but I want to switch to pool connection to my DB (with npm module mysql2), but apparently there's something I'm missing...
If I run my application local, or on the server without nginx, with yarn start, it opens just one pool (I can see them by running the query SHOW PROCESSLIST on the DB in use). But in the moment I add nginx as reverse proxy, every request my app receives opens a pool and the latter never gets closed or called again (apart from the one pool opened if someone visits the page for which I use the nextjs function router.push(/url)).
It happens also if I run yarn dev: it opens a connection pool for every new page next has to build in development or if I make some changes to pages and save. But this behaviour I understand.
The nginx configuration is a normal configuration, and everything works fine.
I've surfed the web far and wide, but didn't find anything that could help me understand what could be going on between nginx-next-mysqldb, and no one reported any problem whatsoever. Is this how it's supposed to be or there's something that I should do to make it work?
Oops... my bad...
Transitioning from single db connections to pool, I left a function which made a single connection, which I was not closing.
So there's no problem and nothing to uncover behind nginx-next-mysql.
Don't know if anyone will stumble upon this problem, ever, but, just make sure you don't have any single connection to your db... And make sure to close them :)
Related
I've had Xdebug set up and working properly in the past, but seem to have a real problem getting it to work consistently. This is a WordPress/WooCommerce install and I'm simply trying to load the homepage with some search query parameters so that I can debug a custom function.
Currently, I can't get it to break properly when I debug using a run configuration. It just won't break at all unless I tick the button to listen for incoming connections. At that point, I have to wade through every single index.php and cron.php process that runs, waiting for the right one to come along.
I'm not crazy, am I? I should be able to look at the single debug process and not all these others? It's as if PhpStorm is not receiving the initial connection when I run the configuration.
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.
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.
I just uploaded a Wordpress site from my local machine to a Bluehost shared server. Ran fine locally, but now it is loading very slowly (107 seconds for home page). Bluehost tech support ran GTMetrix site analyzer and came back with "it's the CSS in your theme". They say nothing is wrong with the server.
I definitely need to clean up my CSS, but I didn't think it could have such a large impact on load times. Am I wrong?
Looking at the resource load times with Chrome's developer tools makes it immediately clear that it's your main document that is responsible for the delay; not the CSS, not anything else.
Therefore we have to assume it's something in your own code that causes the delay. Since it worked fine when run locally, the most likely scenario is that your code is trying to connect to some server (perhaps a database?) that it cannot connect to, and the delay is due to the connection finally timing out.
Recommendation: double check the places where you make connections to any external resource, and especially the credentials used when you do so. Is your host authorized to make these connections the same as your local development machine is? If you are connecting by IP, are those IPs accessible from your host?
The problem is loading
http://ad.doubleclick.net/adi/N5192.395082.LOT18.COM/B5529584;sz=300x250;ord=[timestamp]?
which is probably a script?
That takes 59 seconds for me. The rest is fast.
From the Chrome dev tools (Network tab): http://screencast.com/t/8DdtXeEv
The solution: turn off your ads.
You can use quick cache plugin which will speed up you site without compromise.
http://wordpress.org/extend/plugins/quick-cache/
Sometimes an exception causes application pool to shutdown. I start it manually but the question is how can I automate this behavior in IIS 7.0 (Windows server 2008).
If an application pool dies, the next request for a resource served by that pool will automatically restart it. If, however, you have rapid fail protection enabled on the app pool, and the pool dies more times than the number specified by the maximum failures property within the interval specified by the failure interval property, then you will receive a 503 Service Unavailable message. At this point, you will have to manually restart the app pool.
To work around this, either disable rapid fail protection for the app pool, or try increasing the number of faults within the time period, and then determine the root cause of the exceptions which are terminating the app pool.
open iis select your website and on right hand side u see Actions
under Browse Web site -> Advanced Setting
select start Automatically to true.
I am having a similar problem in Windows Server 2012 Standard and IIS 8. URLs with an ampersand character at the end cause IIS to freak out, and consider them malicious. This causes the App Pool to fail, crashing the website.
What you need to do is watch the Event Viewer for 1309 events. (In the Event ID column) You can set this up using Task Scheduler. When you see the event, you restart the App Pool.
To restart the App Pool, you can use a .vbs script like this:
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
Set oAppPool = oWebAdmin.Get("ApplicationPool.Name='DefaultAppPool'")
' Recycle the application pool.
oAppPool.Recycle
Or you could use Powershell if you like that better.
I use a pretty neat C# program that I found here:
http://www.west-wind.com/weblog/posts/2012/Oct/02/A-tiny-Utility-to-recycle-an-IIS-Application-Pool
It does a great job, and seems to get around some of the permissions issues that the previous two methods have. I do have to run this script as an admin, though.
Hope this helps. It does not solve the problem, but it will take the heat off until there is a solution to this URL issue.