Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Marc Merlin <marcm at magic dot metawire dot com>
Subject: How to find out when you're killed because of a deadlock?
Date: Apr 9 1998 12:51AM


I searched the archive and didn't find anything, so here's the question:

I have a script that does:

    #print "Running query \"$query\"\n";
    ($self->dbsqlexec == &SUCCEED) or die "Died on query \"$query\": $!";

It's been running beautifully for several weeks, but today the cron job
returned the following:

Msg 1205, Level 13, State 1
Line 2
        Your server command (process id #151) was deadlocked with another
process and has been chosen as deadlock victim.  Re-run your command.
DB-Library error:
        General SQL Server error: Check messages from the SQL Server. 

The funny thing is that when I get those kinds of errors (not deadlocks, but
typically  an incorrect  query), dbsqlexec  doesn't return  SUCCEED, and  my
script dies, showing the query that triggered the problem.

The  problem is  that  the  deadlock did  not  prevent  dbsqlexec to  return
&SUCCEED, and my script continued to run, with incomplete data, which messed
up our whole system.

My question is  how can I detect all query  failures, including deadlocks so
that my script can die instead of carying on with incomplete data?

Home page: (browser friendly)
Finger for PGP key (key id 763BE901)
***** "God is real, unless declared integer." *****