Solved

Timeout waiting for SQL Connection

Posted on 2010-08-12
8
357 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

27 Experts available now in Live!

Get 1:1 Help Now