I have this error which happen many times on my site:
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.)"
My site files are on a server and the database on another server, but on the same network.
Anyone know what may cause this problem and how to solve?
Notes:
- When i restart the website server the problem solve and everything work fine.
- Sure my sql server allow remote connections from this website server
It's a pretty generic error when the application can't get to the database. Perhaps you are leaving connections open after using them? There could be a limit on the amount of concurrent connections by user or server.
It's a networking error of some kind, or you're specifying the instance name incorrectly. I've recently seen both cases. In one case, I had moved a connection string from one system, to another system that had a different instance name installed. In another case, I had a server running in a Virtual Machine - about ten minutes after the machine was resumed from suspension, the machine would lose its DHCP lease (and therefore its connectivity).
It could be just about anything, and you'll have to go find out, perhaps by using a network monitor program like Microsoft Network Monitor 3.2.
I found a good article talking about this error, i think it shows the real reason
Understanding the error “An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.”
Related
I am using Perforce as part of a small development team. Everyone was able to connect to the P4V client except for one person who gets the following error:
TCP receive failed.
read: socket: WSAECONNRESET
We have deactivated his McAfee firewall and virus scan, but the error persists. I really don't know what to do with this error and it seems to be rather undocumented on the perforce website. From what I gather, it's because it's not a perforce-specific issue, but rather a TCP communication problem that might be caused by something else.
Any tips?
a TCP communication problem that might be caused by something else.
This is possible, or it's possible that whenever this user connects it causes some sort of server fault.
https://msdn.microsoft.com/en-us/library/ms740668.aspx
WSAECONNRESET 10054 Connection reset by peer.
An existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO_LINGER option on the remote socket). This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress. Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.
Beyond the usual connection troubleshooting questions (is this user on the same subnet? same version of the client software? same exact P4PORT setting? is the user able to connect via the command line client and if not does it give a more helpful error? why is this user unlike all other users?) I'd look at the server logs to see if it's logging any sort of more helpful error when this user tries to connect.
Okay so I got:
A network-related or instance-specific error occurred while
establishing a connection to SQL Server.
Now I know what the problem is (web server couldn't see the database server), however I'm wondering what exactly an instance specific error is and if people have examples? I know it's specific to an instance but what kind of things would fall under that?
Instance in this context means an instance of SQL Server. As you remember, SQL server can be installed in multiple instances on the same machine. Instances are adressed machinename\instancename or by IP x.y.z.t:instanceport.
The error means that the instance you are trying to connect cannot be reached while this is unknown whether or not other instances are running and can be contacted. Thus the
"instance specific" error.
How to Troubleshoot Connecting to the SQL Server Database Engine is a good article about troubleshooting the exception you reference in your question. It summarizes the causes to the following:
This error usually means that the SQL Server computer can't be found
or that the TCP port number is either not known, or is not the correct
port number, or is blocked by a firewall.
If you go through the troubleshooting steps, you will find out that the place to search for the problem is not only network related, but it could be, for example:
the database engine not being configured to accept remote connections on the specific instance
the used protocol not being enabled (for example TCP/IP) on the specific instance
I guess that the exception message tries to keep your troubleshooting focus on more than one option when it comes to put the the finger on the certain culprit subsystem. Or maybe it's just a way of reporting a connection related exception which is impossible to trace.
Background
We have a number of web applications on different web servers that connect to a single database server. Over the past couple months, we have noticed that every once in awhile, our web servers won't be able to connect to the database server.
Our Environment
We have a couple different web environments, some running ColdFusion and others running .NET. The .NET apps are both Web Forms and MVC. They span multiple versions from 2.0 to 4.5. Both the ColdFusion and .NET web servers are windows based machines. Both the ColdFusion and .NET web environments are clustered and some of the machines are physical while others are virtual.
Our database server is SQL Server 2008 r2. It houses multiple databases. Each application has its own database user that it connects with to the server that only gives it access to a particular database.
Other Facts
When we notice issues, they occur in short bursts that last anywhere from a couple seconds to a couple minutes.
When we notice issues, the burst contains errors from multiple different appliations, not just one app at at time.
When we notice issues, the burst contains errors from applications from different web environments. (This makes us think we can rule out that the apps themselves are the issue)
The burst of connection issues happen at various times throughout the day and night. They are not always during times of high usage.
We have monitored things like number of user connections, memory, IO, CPU usage, etc... and we have not seen spikes or anything else that might point to a problem.
We have installed wireshark on the web and db servers in hopes of catching the problem without any success.
Questions
Does anyone have suggestions on where I should look next?
Are there properties of the database that could cause this?
Is there any way to "monitor" the connection between the database and web server in a better manner?
Is there anything that can be done on the app side to better understand what is happening?
Errors Caught by Apps
.NET errors
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
ColdFusion errors
Error Executing Database Query. The TCP/IP connection to the host has failed. java.net.ConnectException: Connection timed out: connect The error occurred on line 38.
Error Executing Database Query. Connection reset by peer: socket write error The error occurred on line 91.
Error Executing Database Query. Timed out trying to establish connection The error occurred on line 38.
In CF, I once had an issue like what you were seeing. I had CF on 1 server, and sql 2008 r2 on another server. I would see CF errors like you posted below. To help trace it to a network error I wrote something like this:
1) created a down.bat
tracert serverip
2) I then put a <cftry><cfcatch> around the query.
When the query generated the error I would execute
<cfexecute name="C:\path\to\down.bat" variable="log" timeout="60" />
<cfmail to="ME" from="Server" subject="SQL DOWN">
Server Debugging Info:
------------------------------------------------------------
#now()#
#cfcatch.Detail#
#cfcatch.Message#
#log#
</cfmail>
</cfexecute>
This helped me fix my situation which ended up being hardware at the datacenter.
So I have an application that connects to our SQLServer.
This works on any server behind the firewall just fine.
When i put it out on our live server, outside the firewall the connection to the sqlserver fails with this error
A network-related or instance-specific error occurred while establishing a connection
to SQL Server. The server was not found or was not accessible. Verify that the instance
name is correct and that SQL Server is configured to allow remote connections. (provider:
SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I know this is due to the firewall though the network admin claims the firewall is allowing it through (has even gone to the point of saying "your doing it wrong")
What can I do to see where it is failing exactly to see if it really is the firewall and prove to him that it is.
I am using the IP of the machine so it is not a DNS issue.
Any other ideas?
With all due respect, your admin is right by telling you you're doing it wrong, assuming if what you mean by "outside the firewall" means outside of your company's network. Something like a database server should never be exposed to external connections.
Edit: Never mind, this is a connection from the DMZ.
So the only thing I can think of is to try and telnet to that machine on port 1433 (while logged into the web server) and see if you get a connection error. You're not using SSPI so I don't think security would be the issue.
If telnet fails then you can take that to your network admin as proof that the problem is the firewall.
Are you using a named instance? Make sure SQL Browsing Service is running.
Usually when you connect to the default instance on your local server you use '(local)'. When it's a named instance you would use '(local)\InstanceName'. Or (local) is replaced by a host name or ipaddress.
When you use a named instance you could run into connection problems when trying to connect from a remote server.
I will get the error below randomly when I'm running an asp.net application I am working on. Usually it will happen ever 3 days or so and I am forced to restart my machine to fix it but it's been getting worse and now a reboot dosn't seem to fix anything. I'm running the application on my machine and doing a lot of debugging. All interactions with the db are done through linq to sql. The db is on another server that I am connecting to. Has anyone run into this before? Any suggestions?
A network-related or instance-specific
error occurred while establishing a
connection to SQL Server. The server
was not found or was not accessible.
Verify that the instance name is
correct and that SQL Server is
configured to allow remote
connections. (provider: TCP Provider,
error: 0 - No such host is known.)
It may be DNS, try to use some different DNS addresses. :)
I've seen similar before but it was related to a faulty network card that was dropping packets. Have you had any other strange network problems?
In your connection string to the db is the host entered as a hostname or an IP address. If by name try swapping to its IP address instead. This won't solve the underlying problem by may workaround it for you.
Edit
Also have a look at this SO answer here. Are you leaving connections open/orphaning them? That would ring true with the disconnect happening at regular time intervals..