New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deadlock with READ ONLY READ COMMITTED NO RECORD_VERSION WAIT transaction [CORE5340] #5615
Comments
Modified by: Gabor Boros (gaborboros)Attachment: READ_DEADLOCK.pas [ 13007 ] |
Commented by: @dyemanov Locks are owned by attachments and attachment cannot wait for itself (it will cause an infinite deadlock), so conflict error is raised immediately if both lock requests belong to the same owner. This is a design limitation rather than a bug. |
Commented by: @dyemanov I'm wondering what you expected from this test case? The only alternative is to hang your application forever "waiting" for the first transaction. |
Commented by: Gabor Boros (gaborboros) So, cannot use two transactions (in this example a reader and a writer) in same attachment in same time by design? "raised immediately"? For me with the attached example exception raised after ~10 seconds (come from DeadlockTimeout in firebird.conf?). |
Commented by: @dyemanov Yes, this is by design. Two conflicting transactions cannot wait for each other inside a single attachment. Deadlock is really detected after the DeadlockTimeout interval. |
Commented by: Gabor Boros (gaborboros) Yes, for me the WAIT transaction means wait "forever" (and continue if the concurrent transaction committed/rollbacked). Which works if the reader and writer transaction separated to two attachments. For the WAIT transaction MON$TRANSACTIONS.MON$LOCK_TIMEOUT value is -1 and Language Reference say "-1 - wait forever". |
Commented by: @dyemanov With two separate attachments, you can "unblock" the waiting transaction by committing / rolling back the blocking transaction. It's impossible if they both belong to the same attachment. In this case WAIT = HANG and the engine detects this signaling a deadlock. |
Commented by: Gabor Boros (gaborboros) Is this "by design" documented somewhere or trivial for everybody except me? :-) Please close this issue... |
Commented by: Attila Molnár (e_pluribus_unum) Hi Gábor! Definition of "Thread-Safety" Currently, the highest level of concurrency supported by any version of the Firebird client library is thread-safety at the connection level. When we say that the Firebird client library is thread-safe at the connection level, we mean that it is safe to use a particular connection in only one thread at a time, although the same connection can be manipulated by different threads in a serial fashion, and different connections can be manipulated by different threads in parallel. |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Gabor Boros (gaborboros)
Attachments:
READ_DEADLOCK.pas
The result of the attached example is:
deadlock
-read conflicts with concurrent update
-concurrent transaction number is 2
The text was updated successfully, but these errors were encountered: