PC Review


Reply
Thread Tools Rate Thread

Connection dies after some idle period of time

 
 
Lee Rennie
Guest
Posts: n/a
 
      17th Aug 2005
Hi

I have this weird situation happening only in a few client machines:

1/ ADO.NET client application opens a connection to an SQL Server DB.
And you can actually see the connection is open in the SQL Profiler

2/ Wait for a couple of minutes...

3/ Press the button (or whatever) that will trigger an SQL command to be
executed.

4/ Although the application thinks that the connection is still open,
the command times out and the connection state is switched to closed
after the failure.
The command doesn't even show up on SQL Profiler, which means it doesn't
actually hit the server.

The problem doesn't happen if we skip step 2 (i.e. no time gap between
opening the connection and executing the command) and in most client
machines it doesn't happen at all, regardless of the connection idle period.


Thanks,
Lee


 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      17th Aug 2005
Don't know why it happens, but it's not a good idea to have an open
connection just sitting there indefinitely. Connection pooling is quite
efficient. Open and close connections when you need to - don't keep an open
one hanging out there.

"Lee Rennie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I have this weird situation happening only in a few client machines:
>
> 1/ ADO.NET client application opens a connection to an SQL Server DB.
> And you can actually see the connection is open in the SQL Profiler
>
> 2/ Wait for a couple of minutes...
>
> 3/ Press the button (or whatever) that will trigger an SQL command to be
> executed.
>
> 4/ Although the application thinks that the connection is still open,
> the command times out and the connection state is switched to closed
> after the failure.
> The command doesn't even show up on SQL Profiler, which means it doesn't
> actually hit the server.
>
> The problem doesn't happen if we skip step 2 (i.e. no time gap between
> opening the connection and executing the command) and in most client
> machines it doesn't happen at all, regardless of the connection idle
> period.
>
>
> Thanks,
> Lee
>
>



 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      17th Aug 2005
It's perfectly okay to design applications that maintain a connection and
manage server state. We've been doing it for decades. The problem of the
connection timing out is a problem that needs to be addressed. I've built
applications that have held connections open for weeks or longer. We have
seen this when the network hardware is flaky or interrupts the connection
while a hand-shake is going on. I would certainly add exception handlers to
your code to attempt to recover from this--there are plenty of "normal"
things that happen in the course of the day that can break a connection.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Lee Rennie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I have this weird situation happening only in a few client machines:
>
> 1/ ADO.NET client application opens a connection to an SQL Server DB.
> And you can actually see the connection is open in the SQL Profiler
>
> 2/ Wait for a couple of minutes...
>
> 3/ Press the button (or whatever) that will trigger an SQL command to be
> executed.
>
> 4/ Although the application thinks that the connection is still open,
> the command times out and the connection state is switched to closed
> after the failure.
> The command doesn't even show up on SQL Profiler, which means it doesn't
> actually hit the server.
>
> The problem doesn't happen if we skip step 2 (i.e. no time gap between
> opening the connection and executing the command) and in most client
> machines it doesn't happen at all, regardless of the connection idle
> period.
>
>
> Thanks,
> Lee
>
>



 
Reply With Quote
 
Lee Rennie
Guest
Posts: n/a
 
      17th Aug 2005
Thanks, William. I was actually wondering why it would happen only in a few
client machines, and I'm pretty happy with your explanation and the solution
for it.

And Marina, thanks all the same for your connection pool suggestion, but I
don't think it's the better option in our case. We have a 2-tier
(client-server) single-threaded application, ie. no application/web server
involved. There's absolutely no point on having a connection pool on each
client machine. It's like your pooling with yourself???? And opening a new
connection every time you need considerably hinders the overall application
performance (we've tested that).




"William (Bill) Vaughn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> It's perfectly okay to design applications that maintain a connection and
> manage server state. We've been doing it for decades. The problem of the
> connection timing out is a problem that needs to be addressed. I've built
> applications that have held connections open for weeks or longer. We have
> seen this when the network hardware is flaky or interrupts the connection
> while a hand-shake is going on. I would certainly add exception handlers
> to your code to attempt to recover from this--there are plenty of "normal"
> things that happen in the course of the day that can break a connection.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
>
> "Lee Rennie" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi
>>
>> I have this weird situation happening only in a few client machines:
>>
>> 1/ ADO.NET client application opens a connection to an SQL Server DB.
>> And you can actually see the connection is open in the SQL Profiler
>>
>> 2/ Wait for a couple of minutes...
>>
>> 3/ Press the button (or whatever) that will trigger an SQL command to be
>> executed.
>>
>> 4/ Although the application thinks that the connection is still open,
>> the command times out and the connection state is switched to closed
>> after the failure.
>> The command doesn't even show up on SQL Profiler, which means it
>> doesn't actually hit the server.
>>
>> The problem doesn't happen if we skip step 2 (i.e. no time gap between
>> opening the connection and executing the command) and in most client
>> machines it doesn't happen at all, regardless of the connection idle
>> period.
>>
>>
>> Thanks,
>> Lee
>>
>>

>
>



 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      18th Aug 2005
I just tripped on something in my ISA server error log that said something
to the effect that the connection on a given IP address timed out. The IP
address in question was one of my local system (inside the domain and the
firewall). I'm going to ask my IT person what would cause that. You might
do the same...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Lee Rennie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks, William. I was actually wondering why it would happen only in a
> few client machines, and I'm pretty happy with your explanation and the
> solution for it.
>
> And Marina, thanks all the same for your connection pool suggestion, but I
> don't think it's the better option in our case. We have a 2-tier
> (client-server) single-threaded application, ie. no application/web server
> involved. There's absolutely no point on having a connection pool on each
> client machine. It's like your pooling with yourself???? And opening a new
> connection every time you need considerably hinders the overall
> application performance (we've tested that).
>
>
>
>
> "William (Bill) Vaughn" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> It's perfectly okay to design applications that maintain a connection and
>> manage server state. We've been doing it for decades. The problem of the
>> connection timing out is a problem that needs to be addressed. I've built
>> applications that have held connections open for weeks or longer. We have
>> seen this when the network hardware is flaky or interrupts the connection
>> while a hand-shake is going on. I would certainly add exception handlers
>> to your code to attempt to recover from this--there are plenty of
>> "normal" things that happen in the course of the day that can break a
>> connection.
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>>
>> "Lee Rennie" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi
>>>
>>> I have this weird situation happening only in a few client machines:
>>>
>>> 1/ ADO.NET client application opens a connection to an SQL Server DB.
>>> And you can actually see the connection is open in the SQL Profiler
>>>
>>> 2/ Wait for a couple of minutes...
>>>
>>> 3/ Press the button (or whatever) that will trigger an SQL command to be
>>> executed.
>>>
>>> 4/ Although the application thinks that the connection is still open,
>>> the command times out and the connection state is switched to closed
>>> after the failure.
>>> The command doesn't even show up on SQL Profiler, which means it
>>> doesn't actually hit the server.
>>>
>>> The problem doesn't happen if we skip step 2 (i.e. no time gap between
>>> opening the connection and executing the command) and in most client
>>> machines it doesn't happen at all, regardless of the connection idle
>>> period.
>>>
>>>
>>> Thanks,
>>> Lee
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Network connection lost when PC is idle for long period NZSchoolTech Windows Vista Networking 1 20th Oct 2008 03:56 PM
screen saver for auto log off after a certain period of idle time Shenan Stanley Windows XP Security 7 9th Mar 2005 06:09 PM
How to auto lock pc when being idle for a period of time nhung t Windows XP Security 2 15th Nov 2003 03:29 PM
Windows XP: internet connection dies after random time! mosekla Windows XP Networking 0 28th Sep 2003 07:38 PM
Timing users of the powerpoint presetation out if idle for a period of time. yates Microsoft Powerpoint 1 10th Jul 2003 04:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:12 PM.