Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Timeout waiting for SQL Connection

Posted on 2010-08-12
8
359 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 63

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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 63

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
 
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 63

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 63

Expert Comment

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

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

829 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