PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.sqlserver.server > Bad behaved client application
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Bad behaved client application

Réponse
 
LinkBack Outils de la discussion
Vieux 16/05/2008, 11h45   #1
AlanPorter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Bad behaved client application

I'm suspecting that one of the .NET applications that connects to our SQL
Server 2005 occasionnaly goes into an infinite loop while inside a
transaction.

Is there a way to force an error on the connection in case it is in a
transaction for more than a specific amount of time, say 30 seconds ?

What would you guys recommend to protect the database from such client
behaviour ? (we don't have much influence on how the clients are programmed)
  Réponse avec citation
Vieux 16/05/2008, 14h15   #2
Andrew J. Kelly
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bad behaved client application

Well I would fix the app first and foremost. But you can use a scheduled
job that checks DBCC OPENTRAN for transactions running longer than x many
seconds. Then use DBCC INPUTBUFFER or fn_Get_Sql to see what that SPID is
doing or look in sysprocesses if this app ahs a particular login etc.. If
you are sure it is the app then KILL the connection.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"AlanPorter" <AlanPorter@discussions.microsoft.com> wrote in message
news:49CEF947-C799-4742-8625-F878408B5094@microsoft.com...
> I'm suspecting that one of the .NET applications that connects to our SQL
> Server 2005 occasionnaly goes into an infinite loop while inside a
> transaction.
>
> Is there a way to force an error on the connection in case it is in a
> transaction for more than a specific amount of time, say 30 seconds ?
>
> What would you guys recommend to protect the database from such client
> behaviour ? (we don't have much influence on how the clients are
> programmed)


  Réponse avec citation
Vieux 16/05/2008, 14h20   #3
Linchi Shea
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: Bad behaved client application

To start, I'd run DBCC OPENTRAN to spot check if there is any long running
tran.

You can write a T-SQL script to take snapshots of
sys.dm_tran_active_transactions DMV in a loop, and if a transaction runs
longer than 30 seconds, log an error yourself.

BTW, what made you suspect that an application was going into an infinite
loop while inside a transaction?

Linchi

"AlanPorter" wrote:

> I'm suspecting that one of the .NET applications that connects to our SQL
> Server 2005 occasionnaly goes into an infinite loop while inside a
> transaction.
>
> Is there a way to force an error on the connection in case it is in a
> transaction for more than a specific amount of time, say 30 seconds ?
>
> What would you guys recommend to protect the database from such client
> behaviour ? (we don't have much influence on how the clients are programmed)

  Réponse avec citation
Vieux 16/05/2008, 16h47   #4
AlanPorter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: Bad behaved client application

I'm new in this position (1 week, previous DBA left abruptly), and people are
mentionning occurences of the database being locked up. From what I've
gathered until now (a number of .NET apps and Excel-based apps are allowed to
read/write the DB tables directly) this sounds like a possible scenario.
Believe it or not this is a fairly critical DB, and we need to stop this
from happening. Even if if find the culprit using the methods you and Andrew
are suggesting, the same bug could be lurching in another client application,
or is about to be deployed by some junior .NET programmer.

It would be great if someone could suggest a generic solution (short of
blocking access to the tables, I've already suggested that and it won't
happen in the near future as it means changes to all of those client
applications)


"Linchi Shea" wrote:

> To start, I'd run DBCC OPENTRAN to spot check if there is any long running
> tran.
>
> You can write a T-SQL script to take snapshots of
> sys.dm_tran_active_transactions DMV in a loop, and if a transaction runs
> longer than 30 seconds, log an error yourself.
>
> BTW, what made you suspect that an application was going into an infinite
> loop while inside a transaction?
>
> Linchi
>
> "AlanPorter" wrote:
>
> > I'm suspecting that one of the .NET applications that connects to our SQL
> > Server 2005 occasionnaly goes into an infinite loop while inside a
> > transaction.
> >
> > Is there a way to force an error on the connection in case it is in a
> > transaction for more than a specific amount of time, say 30 seconds ?
> >
> > What would you guys recommend to protect the database from such client
> > behaviour ? (we don't have much influence on how the clients are programmed)

  Réponse avec citation
Vieux 16/05/2008, 17h22   #5
TheSQLGuru
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bad behaved client application

>> Believe it or not this is a fairly critical DB, and we need to stop this
>> from happening.


If this really is the case then the company should hire a consultant who can
diagnose the problem immediately and offer solutions. Hunting and pecking
for a solution on a news group can easily drag on for days with iterative
questions and answers and suggestions and still not get the problem
resolved.

You can also try Microsoft support to see if they can .

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"AlanPorter" <AlanPorter@discussions.microsoft.com> wrote in message
news:7687EE42-DF54-4BD9-B581-3176E36E80C0@microsoft.com...
> I'm new in this position (1 week, previous DBA left abruptly), and people
> are
> mentionning occurences of the database being locked up. From what I've
> gathered until now (a number of .NET apps and Excel-based apps are allowed
> to
> read/write the DB tables directly) this sounds like a possible scenario.
> Believe it or not this is a fairly critical DB, and we need to stop this
> from happening. Even if if find the culprit using the methods you and
> Andrew
> are suggesting, the same bug could be lurching in another client
> application,
> or is about to be deployed by some junior .NET programmer.
>
> It would be great if someone could suggest a generic solution (short of
> blocking access to the tables, I've already suggested that and it won't
> happen in the near future as it means changes to all of those client
> applications)
>
>
> "Linchi Shea" wrote:
>
>> To start, I'd run DBCC OPENTRAN to spot check if there is any long
>> running
>> tran.
>>
>> You can write a T-SQL script to take snapshots of
>> sys.dm_tran_active_transactions DMV in a loop, and if a transaction runs
>> longer than 30 seconds, log an error yourself.
>>
>> BTW, what made you suspect that an application was going into an infinite
>> loop while inside a transaction?
>>
>> Linchi
>>
>> "AlanPorter" wrote:
>>
>> > I'm suspecting that one of the .NET applications that connects to our
>> > SQL
>> > Server 2005 occasionnaly goes into an infinite loop while inside a
>> > transaction.
>> >
>> > Is there a way to force an error on the connection in case it is in a
>> > transaction for more than a specific amount of time, say 30 seconds ?
>> >
>> > What would you guys recommend to protect the database from such client
>> > behaviour ? (we don't have much influence on how the clients are
>> > programmed)



  Réponse avec citation
Vieux 16/05/2008, 20h31   #6
Andrew J. Kelly
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bad behaved client application

>>>It would be great if someone could suggest a generic solution (short of
blocking access to the tables,

What was wrong with what I suggested? It is about as generic as you can get.
If you are looking to fix the root cause this is about all you can do.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"AlanPorter" <AlanPorter@discussions.microsoft.com> wrote in message
news:7687EE42-DF54-4BD9-B581-3176E36E80C0@microsoft.com...
> I'm new in this position (1 week, previous DBA left abruptly), and people
> are
> mentionning occurences of the database being locked up. From what I've
> gathered until now (a number of .NET apps and Excel-based apps are allowed
> to
> read/write the DB tables directly) this sounds like a possible scenario.
> Believe it or not this is a fairly critical DB, and we need to stop this
> from happening. Even if if find the culprit using the methods you and
> Andrew
> are suggesting, the same bug could be lurching in another client
> application,
> or is about to be deployed by some junior .NET programmer.
>
> It would be great if someone could suggest a generic solution (short of
> blocking access to the tables, I've already suggested that and it won't
> happen in the near future as it means changes to all of those client
> applications)
>
>
> "Linchi Shea" wrote:
>
>> To start, I'd run DBCC OPENTRAN to spot check if there is any long
>> running
>> tran.
>>
>> You can write a T-SQL script to take snapshots of
>> sys.dm_tran_active_transactions DMV in a loop, and if a transaction runs
>> longer than 30 seconds, log an error yourself.
>>
>> BTW, what made you suspect that an application was going into an infinite
>> loop while inside a transaction?
>>
>> Linchi
>>
>> "AlanPorter" wrote:
>>
>> > I'm suspecting that one of the .NET applications that connects to our
>> > SQL
>> > Server 2005 occasionnaly goes into an infinite loop while inside a
>> > transaction.
>> >
>> > Is there a way to force an error on the connection in case it is in a
>> > transaction for more than a specific amount of time, say 30 seconds ?
>> >
>> > What would you guys recommend to protect the database from such client
>> > behaviour ? (we don't have much influence on how the clients are
>> > programmed)


  Réponse avec citation
Vieux 16/05/2008, 22h35   #7
AlanPorter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bad behaved client application

I was looking for something that would prevent an outage, rather than fixing
the problem after it has started locking out people. Could RLV be a quick fix
until I get to know the system better ?

"Andrew J. Kelly" wrote:

> >>>It would be great if someone could suggest a generic solution (short of

> blocking access to the tables,
>
> What was wrong with what I suggested? It is about as generic as you can get.
> If you are looking to fix the root cause this is about all you can do.
>
> --
> Andrew J. Kelly SQL MVP
> Solid Quality Mentors
>
>
> "AlanPorter" <AlanPorter@discussions.microsoft.com> wrote in message
> news:7687EE42-DF54-4BD9-B581-3176E36E80C0@microsoft.com...
> > I'm new in this position (1 week, previous DBA left abruptly), and people
> > are
> > mentionning occurences of the database being locked up. From what I've
> > gathered until now (a number of .NET apps and Excel-based apps are allowed
> > to
> > read/write the DB tables directly) this sounds like a possible scenario.
> > Believe it or not this is a fairly critical DB, and we need to stop this
> > from happening. Even if if find the culprit using the methods you and
> > Andrew
> > are suggesting, the same bug could be lurching in another client
> > application,
> > or is about to be deployed by some junior .NET programmer.
> >
> > It would be great if someone could suggest a generic solution (short of
> > blocking access to the tables, I've already suggested that and it won't
> > happen in the near future as it means changes to all of those client
> > applications)
> >
> >
> > "Linchi Shea" wrote:
> >
> >> To start, I'd run DBCC OPENTRAN to spot check if there is any long
> >> running
> >> tran.
> >>
> >> You can write a T-SQL script to take snapshots of
> >> sys.dm_tran_active_transactions DMV in a loop, and if a transaction runs
> >> longer than 30 seconds, log an error yourself.
> >>
> >> BTW, what made you suspect that an application was going into an infinite
> >> loop while inside a transaction?
> >>
> >> Linchi
> >>
> >> "AlanPorter" wrote:
> >>
> >> > I'm suspecting that one of the .NET applications that connects to our
> >> > SQL
> >> > Server 2005 occasionnaly goes into an infinite loop while inside a
> >> > transaction.
> >> >
> >> > Is there a way to force an error on the connection in case it is in a
> >> > transaction for more than a specific amount of time, say 30 seconds ?
> >> >
> >> > What would you guys recommend to protect the database from such client
> >> > behaviour ? (we don't have much influence on how the clients are
> >> > programmed)

>
>

  Réponse avec citation
Vieux 17/05/2008, 02h48   #8
Andrew J. Kelly
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bad behaved client application

What is RLV? The only way I know of to prevent this is to fix the app.
There is no way to know from the server standpoint what the clients
intentions are and there would be no reasonable way to determine a good
transaction from a bad one. If none of the normal transactions will ever
last more than xx seconds you can kill the ones open longer than that but
that is about as far as it goes. The db has to be flexible enough to let you
do what ever you need to for your applications business requirements. So it
doesn't have anything built in to protect against something like this
because that could be normal for other apps. You could also base this on
how much blocking a particular spid is doing instead of just the length of
the tran but that too can be tricky to tell good from bad.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"AlanPorter" <AlanPorter@discussions.microsoft.com> wrote in message
news:05375AC6-26F3-42D8-B84E-9FC173EC1C4D@microsoft.com...
>I was looking for something that would prevent an outage, rather than
>fixing
> the problem after it has started locking out people. Could RLV be a quick
> fix
> until I get to know the system better ?
>
> "Andrew J. Kelly" wrote:
>
>> >>>It would be great if someone could suggest a generic solution (short
>> >>>of

>> blocking access to the tables,
>>
>> What was wrong with what I suggested? It is about as generic as you can
>> get.
>> If you are looking to fix the root cause this is about all you can do.
>>
>> --
>> Andrew J. Kelly SQL MVP
>> Solid Quality Mentors
>>
>>
>> "AlanPorter" <AlanPorter@discussions.microsoft.com> wrote in message
>> news:7687EE42-DF54-4BD9-B581-3176E36E80C0@microsoft.com...
>> > I'm new in this position (1 week, previous DBA left abruptly), and
>> > people
>> > are
>> > mentionning occurences of the database being locked up. From what I've
>> > gathered until now (a number of .NET apps and Excel-based apps are
>> > allowed
>> > to
>> > read/write the DB tables directly) this sounds like a possible
>> > scenario.
>> > Believe it or not this is a fairly critical DB, and we need to stop
>> > this
>> > from happening. Even if if find the culprit using the methods you and
>> > Andrew
>> > are suggesting, the same bug could be lurching in another client
>> > application,
>> > or is about to be deployed by some junior .NET programmer.
>> >
>> > It would be great if someone could suggest a generic solution (short of
>> > blocking access to the tables, I've already suggested that and it won't
>> > happen in the near future as it means changes to all of those client
>> > applications)
>> >
>> >
>> > "Linchi Shea" wrote:
>> >
>> >> To start, I'd run DBCC OPENTRAN to spot check if there is any long
>> >> running
>> >> tran.
>> >>
>> >> You can write a T-SQL script to take snapshots of
>> >> sys.dm_tran_active_transactions DMV in a loop, and if a transaction
>> >> runs
>> >> longer than 30 seconds, log an error yourself.
>> >>
>> >> BTW, what made you suspect that an application was going into an
>> >> infinite
>> >> loop while inside a transaction?
>> >>
>> >> Linchi
>> >>
>> >> "AlanPorter" wrote:
>> >>
>> >> > I'm suspecting that one of the .NET applications that connects to
>> >> > our
>> >> > SQL
>> >> > Server 2005 occasionnaly goes into an infinite loop while inside a
>> >> > transaction.
>> >> >
>> >> > Is there a way to force an error on the connection in case it is in
>> >> > a
>> >> > transaction for more than a specific amount of time, say 30 seconds
>> >> > ?
>> >> >
>> >> > What would you guys recommend to protect the database from such
>> >> > client
>> >> > behaviour ? (we don't have much influence on how the clients are
>> >> > programmed)

>>
>>


  Réponse avec citation
Vieux 17/05/2008, 16h27   #9
TheSQLGuru
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bad behaved client application

If by RLV you mean Row Level Locking, you can set yourself up for
more/different heartache if you force that and also IIRC lock escalation
will still take place if the engine determines it to be appropriate. Not
100% certain on that however.

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"AlanPorter" <AlanPorter@discussions.microsoft.com> wrote in message
news:05375AC6-26F3-42D8-B84E-9FC173EC1C4D@microsoft.com...
>I was looking for something that would prevent an outage, rather than
>fixing
> the problem after it has started locking out people. Could RLV be a quick
> fix
> until I get to know the system better ?
>
> "Andrew J. Kelly" wrote:
>
>> >>>It would be great if someone could suggest a generic solution (short
>> >>>of

>> blocking access to the tables,
>>
>> What was wrong with what I suggested? It is about as generic as you can
>> get.
>> If you are looking to fix the root cause this is about all you can do.
>>
>> --
>> Andrew J. Kelly SQL MVP
>> Solid Quality Mentors
>>
>>
>> "AlanPorter" <AlanPorter@discussions.microsoft.com> wrote in message
>> news:7687EE42-DF54-4BD9-B581-3176E36E80C0@microsoft.com...
>> > I'm new in this position (1 week, previous DBA left abruptly), and
>> > people
>> > are
>> > mentionning occurences of the database being locked up. From what I've
>> > gathered until now (a number of .NET apps and Excel-based apps are
>> > allowed
>> > to
>> > read/write the DB tables directly) this sounds like a possible
>> > scenario.
>> > Believe it or not this is a fairly critical DB, and we need to stop
>> > this
>> > from happening. Even if if find the culprit using the methods you and
>> > Andrew
>> > are suggesting, the same bug could be lurching in another client
>> > application,
>> > or is about to be deployed by some junior .NET programmer.
>> >
>> > It would be great if someone could suggest a generic solution (short of
>> > blocking access to the tables, I've already suggested that and it won't
>> > happen in the near future as it means changes to all of those client
>> > applications)
>> >
>> >
>> > "Linchi Shea" wrote:
>> >
>> >> To start, I'd run DBCC OPENTRAN to spot check if there is any long
>> >> running
>> >> tran.
>> >>
>> >> You can write a T-SQL script to take snapshots of
>> >> sys.dm_tran_active_transactions DMV in a loop, and if a transaction
>> >> runs
>> >> longer than 30 seconds, log an error yourself.
>> >>
>> >> BTW, what made you suspect that an application was going into an
>> >> infinite
>> >> loop while inside a transaction?
>> >>
>> >> Linchi
>> >>
>> >> "AlanPorter" wrote:
>> >>
>> >> > I'm suspecting that one of the .NET applications that connects to
>> >> > our
>> >> > SQL
>> >> > Server 2005 occasionnaly goes into an infinite loop while inside a
>> >> > transaction.
>> >> >
>> >> > Is there a way to force an error on the connection in case it is in
>> >> > a
>> >> > transaction for more than a specific amount of time, say 30 seconds
>> >> > ?
>> >> >
>> >> > What would you guys recommend to protect the database from such
>> >> > client
>> >> > behaviour ? (we don't have much influence on how the clients are
>> >> > programmed)

>>
>>



  Réponse avec citation
Vieux 18/05/2008, 13h22   #10
AlanPorter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bad behaved client application

I mean Row Level Versioning. I don't have any experience with that,
apparently other connections wouldn't be blocked even if a bad behaved .NET
app stays in a transaction for a very long time. Other connections would just
get the version of the row that was valid before the bad behaved transaction
started.
This would allow us to bridge the time it will take to get the 10+ .NET
applications verified/rewritten.

Anyone has gone this path ?
  Réponse avec citation
Vieux 18/05/2008, 14h43   #11
Andrew J. Kelly
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bad behaved client application

It may if these is a situation where none of the other users need to
update any of those rows as well. If they do they will still be blocked. You
also run the risk of the app now getting old (pre-changed) data to make it's
decisions. If it wasn't written with this in mind you can get incorrect
behavior or results. Only you can make that call. But to be honest it should
be far simpler and faster to find the culprits than to determine if this
other behavior will affect your results or not. Using the methods mentioned
before and a simple trace you should easily be able to narrow down the
offending app and even to the section of the app (by looking at the code
called) that started the tran in which it never closed.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"AlanPorter" <AlanPorter@discussions.microsoft.com> wrote in message
news:798DC1FB-C412-4441-AA59-FD45FFACA3A4@microsoft.com...
>I mean Row Level Versioning. I don't have any experience with that,
> apparently other connections wouldn't be blocked even if a bad behaved
> .NET
> app stays in a transaction for a very long time. Other connections would
> just
> get the version of the row that was valid before the bad behaved
> transaction
> started.
> This would allow us to bridge the time it will take to get the 10+ .NET
> applications verified/rewritten.
>
> Anyone has gone this path ?


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h42.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,28664 seconds with 19 queries