Dan Kenigsberg has uploaded a new change for review.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
betterAsyncore: Fix AttributeError on disconnect
Recently we added logging when SSLError is raised during recv(), which happens when a client disconnects in an unclean way. Unfortunately, logging the error raises an AttributeError and fail to close the connection as intended:
>>> from yajsonrpc.betterAsyncore import Dispatcher >>> d = Dispatcher() >>> d.log.error("message") Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'function' object has no attribute 'error'
Dispatcher.log is a method, not a logger instance.
This patches adds a "vds.dispatcher" logger and use it to log the message.
Since this is an expected event, and logging error and warnings is also duplicated to the system log, we use now info message.
Change-Id: I84387711167de39ea9364f0717f23ba4aa95edf5 Bug-Url: https://bugzilla.redhat.com/1272496 Backport: 3.6 Signed-off-by: Nir Soffer nsoffer@redhat.com Reviewed-on: https://gerrit.ovirt.org/47406 Continuous-Integration: Jenkins CI Reviewed-by: Francesco Romani fromani@redhat.com Reviewed-by: Piotr Kliczewski piotr.kliczewski@gmail.com --- M lib/yajsonrpc/betterAsyncore.py 1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/47421/1
diff --git a/lib/yajsonrpc/betterAsyncore.py b/lib/yajsonrpc/betterAsyncore.py index 97b301a..3d43ffb 100644 --- a/lib/yajsonrpc/betterAsyncore.py +++ b/lib/yajsonrpc/betterAsyncore.py @@ -18,6 +18,7 @@ # while enabling compositing instead of inheritance. from __future__ import absolute_import import asyncore +import logging import socket from errno import EWOULDBLOCK
@@ -26,6 +27,8 @@
class Dispatcher(asyncore.dispatcher): + + _log = logging.getLogger("vds.dispatcher")
def __init__(self, impl=None, sock=None, map=None): # This has to be done before the super initialization because @@ -118,7 +121,7 @@ else: raise except SSL.SSLError as e: - self.log.error('SSL error during reading data: %s', e) + self._log.info('SSL error during recv: %s, closing connection', e) self.handle_close() return ''
automation@ovirt.org has posted comments on this change.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
Patch Set 1:
* Update tracker::#1272496::OK * Check Bug-Url::OK * Check Public Bug::#1272496::OK, public bug * Check Product::#1272496::OK, Correct classification oVirt * Check TM::SKIP, not in a monitored branch (ovirt-3.5 ovirt-3.4 ovirt-3.3 ovirt-3.2) * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Dan Kenigsberg has posted comments on this change.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
Patch Set 1: Code-Review+2
Nir Soffer has posted comments on this change.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
Patch Set 1: Code-Review+1
Piotr Kliczewski has posted comments on this change.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
Patch Set 1: Code-Review+1
Francesco Romani has posted comments on this change.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
Patch Set 1: Code-Review+2
Francesco Romani has posted comments on this change.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
Patch Set 1: Verified+1
Francesco Romani has posted comments on this change.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
Patch Set 1:
verified running with engine until I saw the new message.
Francesco Romani has submitted this change and it was merged.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
betterAsyncore: Fix AttributeError on disconnect
Recently we added logging when SSLError is raised during recv(), which happens when a client disconnects in an unclean way. Unfortunately, logging the error raises an AttributeError and fail to close the connection as intended:
>>> from yajsonrpc.betterAsyncore import Dispatcher >>> d = Dispatcher() >>> d.log.error("message") Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'function' object has no attribute 'error'
Dispatcher.log is a method, not a logger instance.
This patches adds a "vds.dispatcher" logger and use it to log the message.
Since this is an expected event, and logging error and warnings is also duplicated to the system log, we use now info message.
Change-Id: I84387711167de39ea9364f0717f23ba4aa95edf5 Bug-Url: https://bugzilla.redhat.com/1272496 Backport: 3.6 Signed-off-by: Nir Soffer nsoffer@redhat.com Reviewed-on: https://gerrit.ovirt.org/47406 Continuous-Integration: Jenkins CI Reviewed-by: Francesco Romani fromani@redhat.com Reviewed-by: Piotr Kliczewski piotr.kliczewski@gmail.com Reviewed-on: https://gerrit.ovirt.org/47421 Reviewed-by: Dan Kenigsberg danken@redhat.com Tested-by: Francesco Romani fromani@redhat.com --- M lib/yajsonrpc/betterAsyncore.py 1 file changed, 4 insertions(+), 1 deletion(-)
Approvals: Piotr Kliczewski: Looks good to me, but someone else must approve Nir Soffer: Looks good to me, but someone else must approve Jenkins CI: Passed CI tests Dan Kenigsberg: Looks good to me, approved Francesco Romani: Verified; Looks good to me, approved
automation@ovirt.org has posted comments on this change.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
Patch Set 2:
* Update tracker::#1272496::OK * Set MODIFIED::bug 1272496::::#1272496::::IGNORE, not oVirt prod but vdsm
Piotr Kliczewski has posted comments on this change.
Change subject: betterAsyncore: Fix AttributeError on disconnect ......................................................................
Patch Set 1:
Verified by checking disconnection and seeing no issues.
vdsm-patches@lists.fedorahosted.org