i've been wrestling some leaky symptoms as well. the system has two CPUs
and 4GB ram, but after about 3 or 4 months of continual running, it starts
to max out its swap. when that happens, io pegs and the system slows way
down. (it is 64-bit intel hardware from 2009)
weewx is heavily loaded - weather station is a vantage, and the skins make
extensive use of the forecast extension (5 different sources and almost 30
forecast reports).
unfortunately there are also many other processes running on the machine,
including mysql, postgres, apache, so i have not yet determine what is
leading to all the swap.
i've tried using the pmon extension to track the weewx process. that is a
useful when turning on/off specific services/reports to see what affects
overall memory use. but it does not show what is happening within weewx.
so i created a service that should help quantify the leaks - memchk.py is
attached. this uses heapy (part of guppy) to take a snapshot of the
difference in heap usage between each archive interval. it writes out the
top part of the heap usage to /var/tmp/memchk.txt each archive interval.
m
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# Copyright 2016 Matthew Wall
"""weewx module that track memory use
This requires guppy:
sudo pip install guppy
sudo apt-get install python-guppy
[MemoryCheck]
filename = /var/tmp/memchk.txt
"""
import syslog
import time
from guppy import hpy
import weewx
from weewx.engine import StdService
VERSION = "0.1"
def logmsg(level, msg):
syslog.syslog(level, 'memchk: %s' % msg)
def logdbg(msg):
logmsg(syslog.LOG_DEBUG, msg)
def loginf(msg):
logmsg(syslog.LOG_INFO, msg)
def logerr(msg):
logmsg(syslog.LOG_ERR, msg)
class MemoryCheck(StdService):
def __init__(self, engine, config_dict):
super(MemoryCheck, self).__init__(engine, config_dict)
d = config_dict.get('MemoryCheck', {})
self.filename = d.get('filename', '/var/tmp/memchk.txt')
loginf("logging heap to %s on each archive record" % self.filename)
self.heapy = hpy()
self.bind(weewx.NEW_ARCHIVE_RECORD, self.new_archive_record)
def new_archive_record(self, event):
self.check_memory(self.filename, self.heapy.heap())
# make the next heap relative to this one
self.heapy.setrelheap()
@staticmethod
def check_memory(filename, newheap):
tstr = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
with open(filename, "a") as f:
f.write("%s heap:\n" % tstr)
f.write(str(newheap))
f.write("\n")
if __name__=="__main__":
h = hpy()
MemoryCheck.check_memory('/var/tmp/memchktest.txt', h.heap(), None)