<html><head></head><body>Interesting, yep it could well be that the idle code also uses some timeouts while waiting for an event to happen.<br>
<br>
I would suggest to let this be solved by a) a move to python3 b) an ugly hack like inserting a sleep as suggested by Nicolas or by c) using some elegant co-routine based solution that I am not capable to come up with (however I don't see a way how we could get rid of threads easily).<br>
<br>
As I said, I gave up last time I looked into this.<br>
<br>
Sebastian<br><br><div class="gmail_quote">Am 23. März 2015 18:06:26 MEZ, schrieb Alvaro Gamez <alvaro.gamez@hazent.com>:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">Hi again, I got some interesting new information<br /><div><div><div class="gmail_extra"><br /><div class="gmail_quote">2015-03-23 17:20 GMT+01:00 Alvaro Gamez <span dir="ltr"><<a href="mailto:alvaro.gamez@hazent.com" target="_blank">alvaro.gamez@hazent.com</a>></span>:<br /><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"> --- modulename: threading, funcname: wait<br /><br /><div><div class="gmail_extra">threading.py(235): print "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", timeout<br />XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX None<br />threading.py(236): if not self._is_owned():<br /> --- modulename: threading, funcname: _is_owned<br />threading.py(228): if self.__lock.acquire(0):<br />threading.py(232): return True<br />threading.py(238): waiter = _allocate_lock()<br
/>threading.py(239): waiter.acquire()<br />threading.py(240): self.__waiters.append(waiter)<br />threading.py(241): saved_state = self._release_save()<br /> --- modulename: threading, funcname: _release_save<br />threading.py(220): self.__lock.release() # No state to save<br />threading.py(242): try: # restore state no matter what (e.g., KeyboardInterrupt)<br />threading.py(243): if timeout is None: <br />threading.py(244): waiter.acquire()<br />threading.py(255): while True:<br />threading.py(256): gotit = waiter.acquire(0)<br />threading.py(257): if gotit:<br />threading.py(259): remaining = endtime - _time()<br />threading.py(260):
if remaining <= 0:<br />threading.py(262): delay = min(delay * 2, remaining, .05)<br />threading.py(263): _sleep(delay)<br /><br /></div></div></div></blockquote><div><br /></div><div>After placing some more XXX and the like lines (as I told I'm not experiencied with python, I'm sure there's a better way to do this), it seems that I've triggered some optimizations out that provide me a more complete trace.<br /><br />threading.py(258): print "ZZZZZZZZZZZZZZZZZZZZZZZZZ ", timeout<br />ZZZZZZZZZZZZZZZZZZZZZZZZZ 1740<br /><br /></div></div>That threading invocation with a timeout of 1740 matches the value of 29minutes*60seconds of keepalive parameter.<br /><br /></div><div class="gmail_extra">I've applied attached patch to allow a keepalive time of 0 seconds (which internally equates to an infinite wait) and now CPU consumptio
n is 0
and no wakeups are notified by powertop, so I think this is definitely the thing that is making offlineimap consume CPU while IDLING.<br /><br /></div><div class="gmail_extra">Of course attached patch is not a solution, because that 29 minutes is a recommendation of the RFC for IDLE connections, so this is a timeout that should definitely exist, and the one to blame here is Event.wait().<br /><br /></div><div class="gmail_extra">Best regards<br /><br />diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py<br />index 68c8e33..c2c279b 100644<br />--- a/offlineimap/repository/IMAP.py<br />+++ b/offlineimap/repository/IMAP.py<br />@@ -72,7 +72,7 @@ class IMAPRepository(BaseRepository):<br /> return self.getconfboolean("holdconnectionopen", 0)<br /> <br /> def getkeepalive(self):<br />- num = self.getconfint("keepalive", 0)<br />+ return self.getconfint("keepalive", 0)<br
/> if num == 0 and self.getidlefolders():<br /> return 29*60<br /> else:<br /><br /></div><div class="gmail_extra">-- <br /><div>Álvaro Gámez Machado<br /></div>
</div></div></div></div>
<p style="margin-top: 2.5em; margin-bottom: 1em; border-bottom: 1px solid #000"></p><pre class="k9mail"><hr /><br />OfflineIMAP-project mailing list: OfflineIMAP-project@lists.alioth.debian.org<br /><a href="http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project">http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project</a><br /><br />OfflineIMAP homepages:<br />- <a href="https://github.com/OfflineIMAP">https://github.com/OfflineIMAP</a><br />- <a href="http://offlineimap.org">http://offlineimap.org</a></pre></blockquote></div><br>
-- <br>
Sent from mobile phone. Please excuse brevity.</body></html>