Solved

Timeout waiting for SQL Connection

Posted on 2010-08-12
8
356 Views
Last Modified: 2013-11-11
While using LINQ DataContexts I'm scoping each different type of context created to a web request. Imagine on creation of data context place in the web request and reuse for any other client that wants a data context of that type.

 I have encountered the issue during penetration testing where I am running out of connections. What might be the issue?

Do you think that because the DataContext is scoped to the web request and lives for the duration of the web request after its created that I may be exceeding the connection pool limit?

DaTribe
0
Comment
Question by:Richard Lee
  • 4
  • 3
8 Comments
 
LVL 12

Expert Comment

by:NormanMaina
ID: 33421819
are you using the same connection string in all your connections?
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 33421966
Hi DaTribe;

Well the DataContext only opens a connection to the DB when it needs to query the DB for information and then immediately closes the connection which is the default behavior. If you are manually opening the connection for the DataContext and do not close it manually the connection will remain open. If you have only lets say 100 connection in the pool and have request for more then that anything over 100 concurrent connection will have to wait for the first free connection. So in answer to your question, Yes, it is possible.

Fernando
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 33426893
That's what I thought Fernando but I've found a few recommendation for this pattern across the web.

http://code.msdn.microsoft.com/multitierlinqtosql
http://www.west-wind.com/weblog/posts/246222.aspx

Any chance there is something we are missing?

DaTribe
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 33429236
Hi DaTribe;

There is always the chance that someone has overlooked something working in this business. The thing is to look for the reason for why the connection is timing out. For example how many concurrent request are being made to the server and how many connections are allowed in the connection pool. Is the timeouts being caused by network congestion. As for the two links posted I have look them over and could not find what it was stating anything about timeouts. What is the exact error message that is returned when this happens?

Fernando
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 18

Author Comment

by:Richard Lee
ID: 33429320
The scenario is that I cannot recreate the scenario. The issue popped during penetration testing by a third party company. The condition didn't occur under normal usage of the system and this was a side effect of the penetration testing. I thought I would get some expert opinion on the pattern I posted in the links above to see if that might be a problem.

DaTribe
0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 33429484
Well it is hard to diagnose an issue that cannot be reproduced. I do not know how to tell you how to proceed in resolving the issue. You may need to work with the 3rd party trying to pin down where it is happening if they can reproduce it.

Fernando
0
 
LVL 18

Author Closing Comment

by:Richard Lee
ID: 33430386
I think I will have to work with the 3rd party
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 33430523
Yes, I think that is the best way to go. Good luck & Thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
DataGridview Currency Formating? 22 38
c# if statement weird reaction 3 29
Asp.net mvc 5 5 16
fomat Json objects 6 15
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now