Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
cf413589
Commit
cf413589
authored
Jun 24, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: fix crash when a client tries to "steal" the UUID of another client
parent
11debaa9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
neo/lib/node.py
neo/lib/node.py
+1
-0
neo/storage/handlers/identification.py
neo/storage/handlers/identification.py
+5
-3
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+27
-0
No files found.
neo/lib/node.py
View file @
cf413589
...
@@ -409,6 +409,7 @@ class NodeManager(object):
...
@@ -409,6 +409,7 @@ class NodeManager(object):
# XXX: It's probably a bug to include connecting nodes but there's
# XXX: It's probably a bug to include connecting nodes but there's
# no API yet to update manager when connection is established.
# no API yet to update manager when connection is established.
if
node
.
isConnected
(
connecting
=
True
):
if
node
.
isConnected
(
connecting
=
True
):
assert
node
in
self
.
_node_set
,
node
self
.
_identified_dict
[
uuid
]
=
node
self
.
_identified_dict
[
uuid
]
=
node
else
:
else
:
self
.
_identified_dict
.
pop
(
uuid
,
None
)
self
.
_identified_dict
.
pop
(
uuid
,
None
)
...
...
neo/storage/handlers/identification.py
View file @
cf413589
...
@@ -52,9 +52,11 @@ class IdentificationHandler(EventHandler):
...
@@ -52,9 +52,11 @@ class IdentificationHandler(EventHandler):
if
node
is
None
:
if
node
is
None
:
node
=
app
.
nm
.
createClient
(
uuid
=
uuid
)
node
=
app
.
nm
.
createClient
(
uuid
=
uuid
)
elif
node
.
isConnected
():
elif
node
.
isConnected
():
# cut previous connection
# This can happen if we haven't processed yet a notification
node
.
getConnection
().
close
()
# from the master, telling us the existing node is not
assert
not
node
.
isConnected
()
# running anymore. If we accept the new client, we won't
# know what to do with this late notification.
raise
NotReadyError
(
'uuid conflict: retry later'
)
node
.
setRunning
()
node
.
setRunning
()
elif
node_type
==
NodeTypes
.
STORAGE
:
elif
node_type
==
NodeTypes
.
STORAGE
:
if
node
is
None
:
if
node
is
None
:
...
...
neo/tests/threaded/test.py
View file @
cf413589
...
@@ -800,5 +800,32 @@ class Test(NEOThreadedTest):
...
@@ -800,5 +800,32 @@ class Test(NEOThreadedTest):
finally
:
finally
:
cluster
.
stop
()
cluster
.
stop
()
def
testRecycledClientUUID
(
self
):
def
delayNotifyInformation
(
conn
,
packet
):
return
isinstance
(
packet
,
Packets
.
NotifyNodeInformation
)
def
notReady
(
orig
,
*
args
):
m2s
.
remove
(
delayNotifyInformation
)
return
orig
(
*
args
)
cluster
=
NEOCluster
()
try
:
cluster
.
start
()
cluster
.
getTransaction
()
with
cluster
.
master
.
filterConnection
(
cluster
.
storage
)
as
m2s
:
m2s
.
add
(
delayNotifyInformation
)
cluster
.
client
.
master_conn
.
close
()
cluster
.
client
.
setPoll
(
0
)
client
=
ClientApplication
(
name
=
cluster
.
name
,
master_nodes
=
cluster
.
master_nodes
)
p
=
Patch
(
client
.
storage_bootstrap_handler
,
notReady
=
notReady
)
try
:
client
.
setPoll
(
1
)
x
=
client
.
load
(
ZERO_TID
)
finally
:
del
p
client
.
close
()
self
.
assertNotIn
(
delayNotifyInformation
,
m2s
)
finally
:
cluster
.
stop
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
()
unittest
.
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