Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Carlos Ramos Carreño
erp5
Commits
f44e62b1
Commit
f44e62b1
authored
May 22, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When xmlrpc uses expat, catch one more exception type in safeRpcCall.
parent
509719bb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+15
-1
product/ERP5Type/tests/runTestSuite.py
product/ERP5Type/tests/runTestSuite.py
+12
-1
No files found.
erp5/util/testnode/testnode.py
View file @
f44e62b1
...
@@ -43,6 +43,20 @@ DEFAULT_SLEEP_TIMEOUT = 120 # time in seconds to sleep
...
@@ -43,6 +43,20 @@ DEFAULT_SLEEP_TIMEOUT = 120 # time in seconds to sleep
supervisord_pid_file
=
None
supervisord_pid_file
=
None
# XXX: below section is shared with product/ERP5Type/tests/runTestSuite.py .
# They are supposed to be merged into a common library/tool someday, until
# then please keep them synchronised.
# Depending on used xmlrpc backend, different exceptions can be thrown.
SAFE_RPC_EXCEPTION_LIST
=
[
socket
.
error
,
xmlrpclib
.
ProtocolError
,
xmlrpclib
.
Fault
]
parser
,
_
=
xmlrpclib
.
getparser
()
if
xmlrpclib
.
ExpatParser
and
isinstance
(
parser
,
xmlrpclib
.
ExpatParser
):
SAFE_RPC_EXCEPTION_LIST
.
append
(
xmlrpclib
.
expat
.
ExpatError
)
else
:
print
>>
sys
.
stderr
,
'Warning: unhandled xmlrpclib parser %r, some '
\
'exceptions might get through safeRpcCall'
%
(
parser
,
)
SAFE_RPC_EXCEPTION_LIST
=
tuple
(
SAFE_RPC_EXCEPTION_LIST
)
del
parser
,
_
def
safeRpcCall
(
log
,
proxy
,
function_id
,
retry
,
*
args
):
def
safeRpcCall
(
log
,
proxy
,
function_id
,
retry
,
*
args
):
# this method will try infinitive calls to backend
# this method will try infinitive calls to backend
# this can cause testnode to looked "stalled"
# this can cause testnode to looked "stalled"
...
@@ -54,7 +68,7 @@ def safeRpcCall(log, proxy, function_id, retry, *args):
...
@@ -54,7 +68,7 @@ def safeRpcCall(log, proxy, function_id, retry, *args):
log
(
'safeRpcCall called with method : %s'
%
function_id
)
log
(
'safeRpcCall called with method : %s'
%
function_id
)
function
=
getattr
(
proxy
,
function_id
)
function
=
getattr
(
proxy
,
function_id
)
return
function
(
*
args
)
return
function
(
*
args
)
except
(
socket
.
error
,
xmlrpclib
.
ProtocolError
,
xmlrpclib
.
Fault
)
,
e
:
except
SAFE_RPC_EXCEPTION_LIST
,
e
:
log
(
'Exception in safeRpcCall when trying %s with %r'
%
(
function_id
,
args
),
log
(
'Exception in safeRpcCall when trying %s with %r'
%
(
function_id
,
args
),
exc_info
=
sys
.
exc_info
())
exc_info
=
sys
.
exc_info
())
if
not
(
retry
):
if
not
(
retry
):
...
...
product/ERP5Type/tests/runTestSuite.py
View file @
f44e62b1
...
@@ -3,7 +3,18 @@ import argparse, pprint, socket, sys, time, xmlrpclib
...
@@ -3,7 +3,18 @@ import argparse, pprint, socket, sys, time, xmlrpclib
from
DummyTaskDistributionTool
import
DummyTaskDistributionTool
from
DummyTaskDistributionTool
import
DummyTaskDistributionTool
from
ERP5TypeTestSuite
import
ERP5TypeTestSuite
from
ERP5TypeTestSuite
import
ERP5TypeTestSuite
# XXX: below section is shared with erp5/util/testnode/testnode.py .
# They are supposed to be merged into a common library/tool someday, until
# then please keep them synchronised.
# Depending on used xmlrpc backend, different exceptions can be thrown.
SAFE_RPC_EXCEPTION_LIST
=
[
socket
.
error
,
xmlrpclib
.
ProtocolError
,
xmlrpclib
.
Fault
]
parser
,
_
=
xmlrpclib
.
getparser
()
parser
,
_
=
xmlrpclib
.
getparser
()
if
xmlrpclib
.
ExpatParser
and
isinstance
(
parser
,
xmlrpclib
.
ExpatParser
):
SAFE_RPC_EXCEPTION_LIST
.
append
(
xmlrpclib
.
expat
.
ExpatError
)
else
:
print
>>
sys
.
stderr
,
'Warning: unhandled xmlrpclib parser %r, some '
\
'exceptions might get through safeRpcCall'
%
(
parser
,
)
SAFE_RPC_EXCEPTION_LIST
=
tuple
(
SAFE_RPC_EXCEPTION_LIST
)
parser_klass
=
parser
.
__class__
parser_klass
=
parser
.
__class__
__original_feed
=
parser_klass
.
feed
__original_feed
=
parser_klass
.
feed
def
verbose_feed
(
self
,
data
):
def
verbose_feed
(
self
,
data
):
...
@@ -56,7 +67,7 @@ def safeRpcCall(function, *args):
...
@@ -56,7 +67,7 @@ def safeRpcCall(function, *args):
while
True
:
while
True
:
try
:
try
:
return
function
(
*
xmlrpc_arg_list
)
return
function
(
*
xmlrpc_arg_list
)
except
(
socket
.
error
,
xmlrpclib
.
ProtocolError
,
xmlrpclib
.
Fault
)
,
e
:
except
SAFE_RPC_EXCEPTION_LIST
,
e
:
print
>>
sys
.
stderr
,
e
print
>>
sys
.
stderr
,
e
pprint
.
pprint
(
args
,
file
(
function
.
_Method__name
,
'w'
))
pprint
.
pprint
(
args
,
file
(
function
.
_Method__name
,
'w'
))
time
.
sleep
(
retry
)
time
.
sleep
(
retry
)
...
...
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