Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
2a246039
Commit
2a246039
authored
Oct 30, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run two of these to provoke a deadlock on multiple storages.
parent
ca282934
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
src/ZEO/tests/deadlock.py
src/ZEO/tests/deadlock.py
+48
-0
No files found.
src/ZEO/tests/deadlock.py
0 → 100644
View file @
2a246039
import
ZODB
from
ZODB.POSException
import
ConflictError
from
ZEO.ClientStorage
import
ClientStorage
,
ClientDisconnected
from
ZEO.zrpc.error
import
DisconnectedError
import
os
import
random
import
time
L
=
range
(
1
,
100
)
def
main
():
z1
=
ClientStorage
((
'localhost'
,
2001
),
wait
=
1
)
z2
=
ClientStorage
((
'localhost'
,
2002
),
wait
=
2
)
db1
=
ZODB
.
DB
(
z1
)
db2
=
ZODB
.
DB
(
z2
)
c1
=
db1
.
open
()
c2
=
db2
.
open
()
r1
=
c1
.
root
()
r2
=
c2
.
root
()
while
1
:
try
:
try
:
update
(
r1
,
r2
)
except
ConflictError
,
msg
:
print
msg
get_transaction
().
abort
()
c1
.
sync
()
c2
.
sync
()
except
(
ClientDisconnected
,
DisconnectedError
),
err
:
print
"disconnected"
,
err
time
.
sleep
(
2
)
def
update
(
r1
,
r2
):
k1
=
random
.
choice
(
L
)
k2
=
random
.
choice
(
L
)
updates
=
[(
k1
,
r1
),
(
k2
,
r2
)]
random
.
shuffle
(
updates
)
for
key
,
root
in
updates
:
root
[
key
]
=
time
.
time
()
get_transaction
().
commit
()
print
os
.
getpid
(),
k1
,
k2
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment