472,961 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,961 software developers and data experts.

SQL 2000 Error: 1203, Severity: 20, State: 1 Error

Our SQL Server 200 box is getting perflib errors when we get a decent
amount of people using an application that I wrote, call queue system,
web based. To accomplish a queue type system on a button push I wrote
a query like this...

BEGIN TRANSACTION;
Select top 1...fields here...
FROM table with (xlock,readpast)
(2 joins)
WHERE numerous where clauses
ORDER BY 2 order bys.

Now our sql server starts timing out..then in the app log this shows
up....

Error: 1203, Severity: 20, State: 1

Process ID 62 attempting to unlock unowned resource PAG: 6:1:126407.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

The reason I am doing xlock is to make a record not viewable to 2
people if they click the button on the web form that runs the above
query within the same minute, they would get different records....

So to avoid this error which I assume is due to my xlock should I
rethink my query?

Jul 13 '06 #1
3 4875
wreed (wh****@gmail.com) writes:
Our SQL Server 200 box is getting perflib errors when we get a decent
amount of people using an application that I wrote, call queue system,
web based. To accomplish a queue type system on a button push I wrote
a query like this...

BEGIN TRANSACTION;
Select top 1...fields here...
FROM table with (xlock,readpast)
(2 joins)
WHERE numerous where clauses
ORDER BY 2 order bys.

Now our sql server starts timing out..then in the app log this shows
up....
SQL Server times out? If you get a message "Timeout expired" that is a
client-side timeout. Or have you enabled lock timeouts.
Error: 1203, Severity: 20, State: 1

Process ID 62 attempting to unlock unowned resource PAG: 6:1:126407.
...
So to avoid this error which I assume is due to my xlock should I
rethink my query?
1203 is definitely to regard as an internal server error, so you are
hitting a bug of some sort.

It would be interesting to know what happens first, the timeout or the
1203. And what sort of timeout you get.

Since by default most client libraries has a default timeout of 30
seconds, I assume that you have a client-side timeout. When you get
such a timeout, you should always issue a IF @@trancount 0 ROLLBACK
TRANSACTION, because there is no automatic rollback on timeouts.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 13 '06 #2

Erland Sommarskog wrote:
>
SQL Server times out? If you get a message "Timeout expired" that is a
client-side timeout. Or have you enabled lock timeouts.
Error: 1203, Severity: 20, State: 1

Process ID 62 attempting to unlock unowned resource PAG: 6:1:126407.
...
So to avoid this error which I assume is due to my xlock should I
rethink my query?

1203 is definitely to regard as an internal server error, so you are
hitting a bug of some sort.

It would be interesting to know what happens first, the timeout or the
1203. And what sort of timeout you get.

Since by default most client libraries has a default timeout of 30
seconds, I assume that you have a client-side timeout. When you get
such a timeout, you should always issue a IF @@trancount 0 ROLLBACK
TRANSACTION, because there is no automatic rollback on timeouts.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Can it be that I am running a TOP 1 and the query is actually pulling a
whole query back then only taking the top row? Or am I totally wrong
on how a TOP 1 works.

Jul 17 '06 #3
wreed (wh****@gmail.com) writes:
Erland Sommarskog wrote:
>>
SQL Server times out? If you get a message "Timeout expired" that is a
client-side timeout. Or have you enabled lock timeouts.
Error: 1203, Severity: 20, State: 1

Process ID 62 attempting to unlock unowned resource PAG: 6:1:126407.
...
So to avoid this error which I assume is due to my xlock should I
rethink my query?

1203 is definitely to regard as an internal server error, so you are
hitting a bug of some sort.

It would be interesting to know what happens first, the timeout or the
1203. And what sort of timeout you get.

Since by default most client libraries has a default timeout of 30
seconds, I assume that you have a client-side timeout. When you get
such a timeout, you should always issue a IF @@trancount 0 ROLLBACK
TRANSACTION, because there is no automatic rollback on timeouts.

Can it be that I am running a TOP 1 and the query is actually pulling a
whole query back then only taking the top row? Or am I totally wrong
on how a TOP 1 works.
Exactly how a TOP 1 is implemented is up to the optimizer. And what
ORDER BY clause you specified.

Yes, TOP 1, could be part of the reason you get this error, although
the locking hints are even more suspects in this case. But as I said,
this is an internal server error. It should simply not occur, and when
it does, it's not your fault.

....unless you first get the query timeout, and you then fail to rollback
the transaction, and the error happens because this creates a mess.

So when this scenario, do you first get a timeout (which happens in the
client), or do you first get the 1203 error?
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
4
by: Jason | last post by:
My understanding is that in a stored procedure (or any code for that matter) if an error occurs you can detect it by checking @@error variable and raise your own error with raiserror statement. ...
3
by: Michael Teja via SQLMonster.com | last post by:
I made a trigger for delete just like this. " CREATE TRIGGER ON . FOR DELETE AS Declare @severity int, @IdNmbr nvarchar(10) Set @Severity = 0
4
by: interflex | last post by:
We have a three tier application running on two tiers. 1&2 running on one server and a seperate server for the databases. On the database server we are running Windows 2000 Server with 3Gb of RAM...
9
by: Mike | last post by:
How do I prevent SQL Server 2000 from posting successful backup completion messages to the Windows 2000 Application Event Log? I have scheduled jobs which backup my transaction logs on 50+...
2
by: Ananta | last post by:
Hi I am having a problem with the SQL server connected in VC#.net I am using the SQLDataAdaptors to access and fill the data to the DataSets. There are certain pages in sequence which run...
0
by: Maciek | last post by:
Hi, I have this question regarding SQL Server error 3621: "The statement has been terminated." and trapping it in Try...Catch block. I've written sample Stored Procedure which intentionally...
11
by: Andrew Poelstra | last post by:
I hammered this out this morning to fix inconsistancies with the way my programs handle errors. The code itself is fine, in that it compiles with Richard Heathfield's gcc tags (plus -c because it...
12
by: mast2as | last post by:
Hi everyone... I have a TExceptionHandler class that is uses in the code to thow exceptions. Whenever an exception is thrown the TExceptionHander constructor takes an error code (int) as an...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.