Transaction blocking can lead to a deadlock situation, in which a set of transactions arrive at a state where none of them can proceed.
To eliminate a transactional deadlock, the database server selects a connection from those involved in the deadlock, rolls back the changes for the transaction that is active on that connection and returns an error. The database server selects the connection to roll back by using an internal heuristic that prefers the connection with the smallest blocking wait time left as determined by the BLOCKING_TIMEOUT option. If all connections are set to wait forever, then the connection that caused the server to detect a deadlock is selected as the victim connection.
Suppose that the database server has n workers. Thread deadlock occurs when n-1 workers are blocked, and the last worker is about to block. The database server's kernel cannot permit this last worker to block, since doing so results in all workers being blocked, and the database server stops responding. Instead, the database server ends the task that is about to block the last worker, rolls back the changes for the transaction active on that connection, and returns an error.
Database servers with tens or hundreds of connections may experience thread deadlocks in long-running requests, either because of the size of the database or because of blocking. In this case, you may want to increase the value of the -gn server option of the start_iq utility.
To view locks and deadlocks in Sybase Control Center, see the Sybase Control Center online help.