On 10/24/2011 4:11 PM, Charles Stevenson wrote:
--- [snip] ---
I have not yet explored what the deadlock daemon does.
Deadlock daemon ignores these WRITEs w/o explicit locking before hand.
I ran these 2 pgms simultaneously so that they both tried to lock or
write the lock that the other held.
Ran with lines 6/7 variously commented out or left in.
W12 W21
01: CRT TIMEDATE(), 'W12' | CRT TIMEDATE(), 'W21'
02: OPEN 'CDSTMP' TO F ELSE STOP | OPEN 'CDSTMP' TO F ELSE STOP
03: READU REC1 FROM F, 'W1' ELSE NULL | READU REC2 FROM F, 'W2' ELSE NULL
04: INPUT DUM | INPUT DUM
05: CRT TIMEDATE():'...': | CRT TIMEDATE():'...':
06: *** READU REC2 FROM F, W2 ELSE NULL | READU REC1 FROM F, 'W1' ELSE NULL
07: WRITE TIME() TO F, 'W2' | WRITE TIME() TO F, 'W1'
08: CRT TIMEDATE() | CRT TIMEDATE()
They invariably entered a deadly embrace, both processes waiting on the
other, but the deadlock daemon ignored it if there is no explicit readu.
Instead one of them aborted with a write failure in 20 minutes (the
default, but configurable action), then the other then continued happily.
I hope no one but I ever cares about this.
Moral of the story:
Explicitly lock before you update.
cds
On 10/24/2011 4:11 PM, Charles Stevenson wrote:
UV 10.2.10 on Windows is behaving differently from what I recall.
Are my expectations out of line?
Suppose Session A holds a readu lock; and Session B attempts a WRITE
to same record withOUT!!! 1st explicitly getting the readu lock.
Session B waits for Session A to release the lock before writing the
record.
While Session B is waiting, does it show up as a "waiter" in
LIST.READU EVERY?
I expected so, but it doesn't.
Session A Session B
_____________________________ ___________________
1A. ED VOC DUMMY
(this sets the readu lock.)
2A. (stay in editor) 2B. run this:
01: OPEN 'VOC' TO F ELSE STOPM
'nope'
02: ***READU REC FROM F, 'DUMMY'
ELSE NULL
03: WRITE '' TO F, 'DUMMY'
3A. Within ED:
XEQ LIST.READU EVERY
If I UN-comment line 2, LIST.READU EVERY shows something like this:
Active Read Waiters: Owner Waiter
Device.... Inode.... Userno Userno
746117947 232860913 6116 3396
But when I comment out line 2, LIST.READU is silent.
I have not yet explored what the deadlock daemon does.
TIA,
cds
P.S. Yes, yes, "Bad Form", "Legacy Software", 20 min wait is
configurable, . . . we can talk later.
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users