Kbase P102639: Users are deadlocking on each other, generating error 2624
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  04/08/2009 |
|
Status: Verified
SYMPTOM(s):
Users are deadlocking on each other, generating error 2624.
Error 2624 generated to each deadlocked user's screen.
<file-name> in use by <user> on <tty>. Wait or choose CANCEL to stop. (2624)
FACT(s) (Environment):
The 4GL code being used is using SHARE locks.
The 4GL code being used is using EXCLUSIVE locks.
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
CAUSE:
Share (SHR) locks are the default Progress record locking method, although they are best not to be used because they can cause deadlocks.
FIX:
Change the application 4GL code to use either NO-LOCK or EXCLUSIVE-LOCK when finding records.
You may also decide to use both NO-LOCK and EXCLUSIVE-LOCK to reduce the time that a record is locked. Below is a corrected example of the failing code example shown in the NOTE.
FIND FIRST customer NO-LOCK.
MESSAGE "Before updating" VIEW-AS ALERT-BOX.
REPEAT:
FIND FIRST customer EXCLUSIVE-LOCK NO-WAIT NO-ERROR.
IF NOT LOCKED customer THEN
DO:
name = name + ".".
RELEASE customer. /* so the lock doesn't downgrade to SHR and bleed to the procedure block */
LEAVE.
END.
MESSAGE "Record being updated elsewhere, retrying in 2 seconds".
PAUSE 2.
END.
MESSAGE "After updating" VIEW-AS ALERT-BOX.