Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
1e0c5efc
Commit
1e0c5efc
authored
Jan 04, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Master must not die if client sends an invalid ttid
parent
8aef2569
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
4 deletions
+26
-4
neo/client/app.py
neo/client/app.py
+1
-0
neo/client/handlers/__init__.py
neo/client/handlers/__init__.py
+3
-0
neo/lib/handler.py
neo/lib/handler.py
+1
-1
neo/master/transactions.py
neo/master/transactions.py
+5
-2
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+16
-1
No files found.
neo/client/app.py
View file @
1e0c5efc
...
...
@@ -733,6 +733,7 @@ class Application(object):
tid
=
self
.
_askPrimary
(
Packets
.
AskFinishTransaction
(
txn_context
[
'ttid'
],
cache_dict
),
cache_dict
=
cache_dict
,
callback
=
f
)
assert
tid
return
tid
finally
:
self
.
_load_lock_release
()
...
...
neo/client/handlers/__init__.py
View file @
1e0c5efc
...
...
@@ -16,6 +16,7 @@
from
neo.lib.handler
import
EventHandler
from
neo.lib.protocol
import
ProtocolError
,
Packets
from
ZODB.POSException
import
StorageError
class
BaseHandler
(
EventHandler
):
"""Base class for client-side EventHandler implementations."""
...
...
@@ -59,3 +60,5 @@ class AnswerBaseHandler(EventHandler):
packetReceived
=
unexpectedInAnswerHandler
peerBroken
=
unexpectedInAnswerHandler
def
protocolError
(
self
,
conn
,
message
):
raise
StorageError
(
"protocol error: %s"
%
message
)
neo/lib/handler.py
View file @
1e0c5efc
...
...
@@ -162,7 +162,7 @@ class EventHandler(object):
# Error packet handlers.
def
error
(
self
,
conn
,
code
,
message
):
def
error
(
self
,
conn
,
code
,
message
,
**
kw
):
try
:
getattr
(
self
,
Errors
[
code
])(
conn
,
message
)
except
(
AttributeError
,
ValueError
):
...
...
neo/master/transactions.py
View file @
1e0c5efc
...
...
@@ -17,7 +17,7 @@
from
time
import
time
from
struct
import
pack
,
unpack
from
neo.lib
import
logging
from
neo.lib.protocol
import
uuid_str
,
ZERO_TID
from
neo.lib.protocol
import
ProtocolError
,
uuid_str
,
ZERO_TID
from
neo.lib.util
import
dump
,
u64
,
addTID
,
tidFromTime
class
DelayedError
(
Exception
):
...
...
@@ -295,7 +295,10 @@ class TransactionManager(object):
Prepare a transaction to be finished
"""
# XXX: not efficient but the list should be often small
try
:
txn
=
self
.
_ttid_dict
[
ttid
]
except
KeyError
:
raise
ProtocolError
(
"unknown ttid %s"
%
dump
(
ttid
))
node
=
txn
.
getNode
()
for
_
,
tid
in
self
.
_queue
:
if
ttid
==
tid
:
...
...
neo/tests/threaded/test.py
View file @
1e0c5efc
...
...
@@ -27,7 +27,7 @@ from neo.lib.connection import MTClientConnection
from
neo.lib.protocol
import
CellStates
,
ClusterStates
,
NodeStates
,
Packets
,
\
ZERO_TID
from
.
import
ClientApplication
,
NEOCluster
,
NEOThreadedTest
,
Patch
from
neo.lib.util
import
makeChecksum
from
neo.lib.util
import
add64
,
makeChecksum
from
neo.client.pool
import
CELL_CONNECTED
,
CELL_GOOD
class
PCounter
(
Persistent
):
...
...
@@ -649,6 +649,21 @@ class Test(NEOThreadedTest):
finally
:
cluster
.
stop
()
def
testInvalidTTID
(
self
):
cluster
=
NEOCluster
()
try
:
cluster
.
start
()
client
=
cluster
.
client
client
.
setPoll
(
1
)
txn
=
transaction
.
Transaction
()
client
.
tpc_begin
(
txn
)
txn_context
=
client
.
_txn_container
.
get
(
txn
)
txn_context
[
'ttid'
]
=
add64
(
txn_context
[
'ttid'
],
1
)
self
.
assertRaises
(
POSException
.
StorageError
,
client
.
tpc_finish
,
txn
,
None
)
finally
:
cluster
.
stop
()
if
__name__
==
"__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