Hello!
I faced with a strange behavior of CURRENTTRANSACTIONTYPE operator.
I have two sessions of NAV - the first is writing to the table from time to time and the second is reading. For the second session it is needed to read only commited data.
I have the "lock timeout" option on and timeout duration of 300 seconds.
When I use CURRENTTRANSACTIONTYPE(TRANSACTIONTYPE::Update) before reading the data in the second session and the table is locked by the first session after approx. 5 seconds I receive an error:
Your activity was deadlocked with another user modifying the xxx table.
Start again.
But if I run the same code again while the table is still blocked everything works fine - the second session waits until the lock is released or timeout is expired.
If I use
LOCKABLE
or
CURRENTTRANSACTIONTYPE(TRANSACTIONTYPE::Update)
LOCKTIMEOUT(FALSE);
everithing works fine - the system waits until lock is released without any error messages.
Does any one know is it a bug or it is by disign?
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
For the testing purposes I've created two forms with a button in each.
The first form has the following code in "on push" trigger:
The second form's code:
And it raises an error during the first execution. But if I push the button again (while the transaction in the first form is still running) it works OK - waits until transaction finishes.
The following code works fine (without error during first execution):
and this one works fine too:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.