Change in vdsm[master]: xmlrpc: do not block forever when waiting on incoming messages
piotr.kliczewski at gmail.com
piotr.kliczewski at gmail.com
Fri Jun 26 14:52:01 UTC 2015
Piotr Kliczewski has uploaded a new change for review.
Change subject: xmlrpc: do not block forever when waiting on incoming messages
......................................................................
xmlrpc: do not block forever when waiting on incoming messages
get_request method is used in BaseServer#_handle_request_noblock and it
is explicitly stated in docstring that the method should not block.
We can't use xmlrpc built-in timeout handling because we detect a
protocol and pass socket for processing.
Change-Id: I295e3099ea06d786741164e1f240f4662631bf8a
Signed-off-by: pkliczewski <piotr.kliczewski at gmail.com>
---
M lib/vdsm/xmlrpc.py
M vdsm/rpc/bindingxmlrpc.py
2 files changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/42915/2
diff --git a/lib/vdsm/xmlrpc.py b/lib/vdsm/xmlrpc.py
index b98282b..6036527 100644
--- a/lib/vdsm/xmlrpc.py
+++ b/lib/vdsm/xmlrpc.py
@@ -128,7 +128,11 @@
self.queue.put((connected_socket, socket_address))
def get_request(self):
- return self.queue.get(True)
+ """
+ We do not want to block so we wait 3 seconds for incoming
+ requests and Empty exception is raised.
+ """
+ return self.queue.get(block=True, timeout=3)
def server_close(self):
self.queue.put((None, None))
diff --git a/vdsm/rpc/bindingxmlrpc.py b/vdsm/rpc/bindingxmlrpc.py
index 21a545d..6e68c19 100644
--- a/vdsm/rpc/bindingxmlrpc.py
+++ b/vdsm/rpc/bindingxmlrpc.py
@@ -24,6 +24,7 @@
import logging
import libvirt
import threading
+import Queue
import re
import sys
@@ -66,6 +67,8 @@
while self._enabled:
try:
self.server.handle_request()
+ except Queue.Empty:
+ pass
except Exception as e:
if e[0] != EINTR:
self.log.error("xml-rpc handler exception",
--
To view, visit https://gerrit.ovirt.org/42915
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I295e3099ea06d786741164e1f240f4662631bf8a
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
More information about the vdsm-patches
mailing list