Solved

Timeout waiting for SQL Connection

Posted on 2010-08-12
8
364 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
[X]
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
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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