Subject Re: [Firebird-Java] Re: Deadlocks in test application
Author Mark Rotteveel
On 2-4-2010 23:58, Roman Rokytskyy wrote:
> But in general there is no single recommended procedure, as it depends
> on your application logic. You can, for example, change the transaction
> parameters to nowait and get exception right when a deadlock is
> detected. In this case you might do something else in case of deadlock.

Calling this situation a deadlock is incorrect. A deadlock is a
situation is where two (or more) actors (threads/connections) wait on
each other to release a resource they need to continue (and then to
release all their resources).

Eg:
Actor 1 has a lock on resource 1 and needs a lock on resource 2 to continue
Actor 2 has a lock on resource 2 and needs a lock on resource 1 to continue
=> Deadlock.

The case mentioned in this discussion is a concurrent modification or
transaction isolation issue, not deadlock (because the first actor can
continue):

Situation:
Actor 1 modifies resource 1
Actor 2 wants to modify resource 1
=> Actor 1 succeeds, actor 2 fails because of the modification already
done by actor 1

--
Mark Rotteveel