Commit bc62d8dc authored by Tim Peters's avatar Tim Peters

Merge rev 28769 from 3.3 branch.

Forward-port from ZODB 3.2.

Collector 1503:  excessive logging.

ClientStorage._wait_sync():  Don't log more than one "waiting for cache
verification to finish" message per 5 minutes.
parent 999247a0
...@@ -78,6 +78,15 @@ ZEO client cache ...@@ -78,6 +78,15 @@ ZEO client cache
- Fixed a bug wherein an object removed from the client cache didn't - Fixed a bug wherein an object removed from the client cache didn't
properly mark the file slice it occupied as being available for reuse. properly mark the file slice it occupied as being available for reuse.
ZEO
---
Collector 1503: excessive logging. It was possible for a ZEO client to
log "waiting for cache verification to finish" messages at a very high
rate, producing gigabytes of such messages in short order.
``ClientStorage._wait_sync()`` was changed to log no more than one
such message per 5 minutes.
persistent persistent
---------- ----------
...@@ -112,7 +121,6 @@ made, it was possible for the pack routine to die with a reference to an ...@@ -112,7 +121,6 @@ made, it was possible for the pack routine to die with a reference to an
undefined global while it was trying to raise ``CorruptedError``. It undefined global while it was trying to raise ``CorruptedError``. It
raises ``CorruptedError``, as it always intended, in these cases now. raises ``CorruptedError``, as it always intended, in these cases now.
Install Install
------- -------
......
...@@ -353,20 +353,28 @@ class ClientStorage(object): ...@@ -353,20 +353,28 @@ class ClientStorage(object):
self._wait_sync(deadline) self._wait_sync(deadline)
def _wait_sync(self, deadline=None): def _wait_sync(self, deadline=None):
# If there is no mainloop running, this code needs # Log no more than one "waiting" message per LOG_THROTTLE seconds.
# to call poll() to cause asyncore to handle events. LOG_THROTTLE = 300 # 5 minutes
while 1: next_log_time = time.time()
if self._ready.isSet():
break while not self._ready.isSet():
if deadline and time.time() > deadline: now = time.time()
if deadline and now > deadline:
log2("Timed out waiting for connection", level=logging.WARNING) log2("Timed out waiting for connection", level=logging.WARNING)
break break
if now >= next_log_time:
log2("Waiting for cache verification to finish") log2("Waiting for cache verification to finish")
next_log_time = now + LOG_THROTTLE
if self._connection is None: if self._connection is None:
# If the connection was closed while we were # If the connection was closed while we were
# waiting for it to become ready, start over. # waiting for it to become ready, start over.
return self._wait(deadline - time.time()) if deadline is None:
timeout = None
else: else:
timeout = deadline - now
return self._wait(timeout)
# No mainloop ia running, so we need to call something fancy to
# handle asyncore events.
self._connection.pending(30) self._connection.pending(30)
def close(self): def close(self):
......
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