Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stumped on locking error

Status
Not open for further replies.

iwease

IS-IT--Management
Sep 4, 2006
104
CA
I have a web app that is running from a SQL Server 2005 database. Periodically, the app generates a timeout error, but if I run the command from management studio, it takes less than a second. Furthermore, the timeout error appears to happen randomly and does not occur with only a specific command.

My first guess was that maybe the database was locking due to a transaction. All my transactions are contained within a single stored procedure and follow the format

BEGIN TRY
BEGIN TRANSACTION
...
code
...
Commit
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION

DECLARE @msg VARCHAR(500)
DECLARE @severity INT
DECLARE @state INT
SET @severity= ERROR_SEVERITY()
SET @state=ERROR_STATE()
SET @msg = ERROR_MESSAGE()

RAISERROR(@msg,@severity,@state)
END CATCH

So, I set up the SQL Server PRofiler to see what was happennning. Unfortunately, I cannot recreate the error (it just occurs randomly and I can't just play with the program all day waiting for it to happen) so I have to rely on others to tell me when it occurs. One person gave me the time and when I checked it out on the profiler, it seemed to correspond to an Audit Logout with a duration of about 7.5 minutes. Does this sound like the cause of my issue? And if so, how can i fix it? I'm using the microsoft enterprise library for my database access so it handles all the opening and closing of connections for me.

Thanks in advance
 
Did you set nocount on in the SP?

I wondered why the baseball was getting bigger.
Then it hit me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top