2013-05-03, 17:22
During some profiling work i noticed that thread XBPython StorageServer.py ("Common plugin Cache") keeps hammering my system with a socket select in StorageServer.py every 0,5 sec. This consumes a lot of cpu power on iPad/iPhone/Androids/RPi's. Is this a bug or feature? "time.sleep(0.5)" is the guilty line down below in section 2. Btw, what's the purpose of that poll loop? /Thanks, Lars.
Call path:
1. File: "addons/script.common.plugin.cache/default.py"
2. File: "addons/script.common.plugin.cache/lib/StorageServer.py"
Call path:
1. File: "addons/script.common.plugin.cache/default.py"
Code:
def run():
sys.path = [settings.getAddonInfo('path') + "/lib"] + sys.path
import StorageServer
s = StorageServer.StorageServer(False)
print " StorageServer Module loaded RUN"
print s.plugin + " Starting server"
s.run()
return True
2. File: "addons/script.common.plugin.cache/lib/StorageServer.py"
Code:
while not self._aborting():
if waiting == 0:
self._log("accepting", 3)
waiting = 1
try:
(self.clientsocket, address) = sock.accept()
if waiting == 2:
self._log("Waking up, slept for %s seconds." % int(time.time() - idle_since))
waiting = 0
except socket.error, e:
if e.errno == 11 or e.errno == 10035 or e.errno == 35:
# There has to be a better way to accomplish this.
if idle_since + self.idle < time.time():
if self.instance:
self.die = True
if waiting == 1:
self._log("Idle for %s seconds. Going to sleep. zzzzzzzz " % self.idle)
time.sleep(0.5)
waiting = 2
continue
self._log("EXCEPTION : " + repr(e))
except:
pass