Commit 82672031 authored by Julien Muchembled's avatar Julien Muchembled

qa: in threaded tests, log queued packets when "tic is looping forever"

parent 323fd636
...@@ -33,7 +33,8 @@ from neo.lib.connection import BaseConnection, \ ...@@ -33,7 +33,8 @@ from neo.lib.connection import BaseConnection, \
from neo.lib.connector import SocketConnector, ConnectorException from neo.lib.connector import SocketConnector, ConnectorException
from neo.lib.handler import EventHandler from neo.lib.handler import EventHandler
from neo.lib.locking import SimpleQueue from neo.lib.locking import SimpleQueue
from neo.lib.protocol import ClusterStates, Enum, NodeStates, NodeTypes, Packets from neo.lib.protocol import uuid_str, \
ClusterStates, Enum, NodeStates, NodeTypes, Packets
from neo.lib.util import cached_property, parseMasterList, p64 from neo.lib.util import cached_property, parseMasterList, p64
from .. import (getTempDirectory, setupMySQLdb, from .. import (getTempDirectory, setupMySQLdb,
ImporterConfigParser, NeoTestBase, Patch, ImporterConfigParser, NeoTestBase, Patch,
...@@ -263,6 +264,7 @@ class TestSerialized(Serialized): ...@@ -263,6 +264,7 @@ class TestSerialized(Serialized):
if r: if r:
return r return r
Serialized.tic(step=1, timeout=.001) Serialized.tic(step=1, timeout=.001)
ConnectionFilter.log()
raise Exception("tic is looping forever") raise Exception("tic is looping forever")
return self._epoll.poll(timeout) return self._epoll.poll(timeout)
...@@ -549,6 +551,20 @@ class ConnectionFilter(object): ...@@ -549,6 +551,20 @@ class ConnectionFilter(object):
else: else:
del cls.filter_queue[conn] del cls.filter_queue[conn]
@classmethod
def log(cls):
try:
if cls.filter_queue:
logging.info('%s:', cls.__name__)
for conn, queue in cls.filter_queue.iteritems():
app = NEOThreadedTest.getConnectionApp(conn)
logging.info(' %s %s:', uuid_str(app.uuid), conn)
for p in queue:
logging.info(' #0x%04x %s',
p.getId(), p.__class__.__name__)
except Exception:
logging.exception('')
def add(self, filter, *patches): def add(self, filter, *patches):
with self.lock: with self.lock:
self.filter_dict[filter] = patches self.filter_dict[filter] = patches
...@@ -601,6 +617,7 @@ class NEOCluster(object): ...@@ -601,6 +617,7 @@ class NEOCluster(object):
if lock(False): if lock(False):
return True return True
Serialized.tic(step=1, quiet=True, timeout=.001) Serialized.tic(step=1, quiet=True, timeout=.001)
ConnectionFilter.log()
raise Exception("tic is looping forever") raise Exception("tic is looping forever")
return lock(False) return lock(False)
self._lock = _lock self._lock = _lock
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment