Kbase P60222: Record remains locked even after releasing that record
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Verified
SYMPTOM(s):
Record remains locked even after releasing that record
The following code ilustrate the issue.
DEF VAR i AS INTEGER INIT 1.
REPEAT TRANSACTION:
ASSIGN i = i + 1.
FIND FIRST customer.
ASSIGN customer.NAME = STRING(i).
RELEASE customer.
MESSAGE "Run your second session retrieving the same record with exclusive-lock"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
IF i = 5 THEN QUIT.
END.
FACT(s) (Environment):
All Supported Operating Systems
Progress/OpenEdge Versions
CAUSE:
This is expected behavior. If Transaction has not being commited, the record lock will not be release.
RELEASE or FIND CURRENT NO-LOCK should not be inside the REPEAT TRANSACTION BLOCK.
FIX:
Write a shorter transaction using DO TRANSACTION and downgrade the share-lock to no-lock as follows:
DEF VAR i AS INTEGER INIT 1.
REPEAT:
DO TRANSACTION:
ASSIGN i = i + 1.
FIND FIRST customer.
ASSIGN customer.NAME = STRING(i).
END.
/* Lock will be downgraded when transaction is committed. */
FIND CURRENT customer NO-LOCK.
MESSAGE "Run your second session retrieving the same record with exclusive-lock"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
IF i = 5 THEN QUIT.
END.