Change in vdsm[master]: protocoldetector: Make cleanup more deterministic

nsoffer at redhat.com nsoffer at redhat.com
Fri Jan 23 19:59:54 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: protocoldetector: Make cleanup more deterministic
......................................................................

protocoldetector: Make cleanup more deterministic

Protocol detector was setting the next cleanup time on each cleanup, by
adding the cleanup internal to the currnet time. Since cleanup was done
after processing all the events, and cleanup time was reached, this
introduced small non-deterministic drift to the cleanup time, making the
logic harder to test.

Adding additional logging show that the server cleans up 2 milliseconds too
late, causing the test to fail.

1422041252.455594: vds.MultiProtocolAcceptor DEBUG Adding detector <protocoldetectorTests.Echo object at 0x7f49ba4c4410>
1422041252.455715: vds.MultiProtocolAcceptor DEBUG Adding detector <protocoldetectorTests.Uppercase object at 0x7f49ba4c4450>
1422041252.455924: vds.MultiProtocolAcceptor DEBUG Running
1422041252.455979: vds.MultiProtocolAcceptor DEBUG Using required_size=9
1422041252.456336: vds.MultiProtocolAcceptor DEBUG Adding connection 127.0.0.1:42807
1422041252.456397: AcceptorTests DEBUG client 127.0.0.1:42807 waiting...
1422041252.456564: AcceptorTests DEBUG client 127.0.0.1:42808 waiting...
1422041252.456640: vds.MultiProtocolAcceptor DEBUG Adding connection 127.0.0.1:42808
1422041252.456872: vds.MultiProtocolAcceptor DEBUG Adding connection 127.0.0.1:42809
1422041252.456926: AcceptorTests DEBUG client 127.0.0.1:42809 waiting...
1422041252.457131: vds.MultiProtocolAcceptor DEBUG Adding connection 127.0.0.1:42810
1422041252.457197: AcceptorTests DEBUG client 127.0.0.1:42810 waiting...
1422041252.457416: vds.MultiProtocolAcceptor DEBUG Adding connection 127.0.0.1:42811
1422041252.457470: AcceptorTests DEBUG client 127.0.0.1:42811 waiting...
1422041253.456519: vds.MultiProtocolAcceptor DEBUG cleaning up pending connections (elasped 1.000919)
1422041253.456709: vds.MultiProtocolAcceptor DEBUG Removing connection 127.0.0.1:42807
1422041254.456889: AcceptorTests DEBUG client 127.0.0.1:42807 woke up
1422041254.457284: AcceptorTests DEBUG client 127.0.0.1:42808 woke up
1422041254.457373: vds.MultiProtocolAcceptor DEBUG Detected protocol echo from 127.0.0.1:42808
1422041254.457416: vds.MultiProtocolAcceptor DEBUG Removing connection 127.0.0.1:42808
1422041254.457633: vds.MultiProtocolAcceptor DEBUG cleaning up pending connections (elasped 2.002052)
1422041254.457727: vds.MultiProtocolAcceptor DEBUG Removing connection 127.0.0.1:42811
1422041254.457781: vds.MultiProtocolAcceptor DEBUG Removing connection 127.0.0.1:42809
1422041254.457828: vds.MultiProtocolAcceptor DEBUG Removing connection 127.0.0.1:42810
1422041254.458750: AcceptorTests DEBUG client 127.0.0.1:42809 woke up
1422041254.458858: AcceptorTests DEBUG client 127.0.0.1:42811 woke up
1422041254.459377: AcceptorTests DEBUG client 127.0.0.1:42810 woke up

This patches changes the calculation so it is more deterministic. We don't know
when the server will wake up and how much time will be spent handling the
events, but know eexactly what is the next cleanup time.

Note that this does not prevent failures of the tests, since they are too
delicate, depending on task scheduling. This will be fixed in the next patch.

Change-Id: Ib4f4e40e64aab0443270a971f46f96a36d298d63
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/protocoldetector.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/37248/1

diff --git a/vdsm/protocoldetector.py b/vdsm/protocoldetector.py
index e4a818a..6d74c8b 100644
--- a/vdsm/protocoldetector.py
+++ b/vdsm/protocoldetector.py
@@ -123,7 +123,7 @@
 
         now = time.time()
         if now > self._next_cleanup:
-            self._next_cleanup = now + self.CLEANUP_INTERVAL
+            self._next_cleanup += self.CLEANUP_INTERVAL
             self._cleanup_pending_connections()
 
     def _cleanup(self):


-- 
To view, visit http://gerrit.ovirt.org/37248
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4f4e40e64aab0443270a971f46f96a36d298d63
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list