tobyweston / temperature-machine

Data logger for multiple DS18B20 temperature sensors on one or more machines
Apache License 2.0
67 stars 22 forks source link

memory full #81

Open dieandgo opened 5 years ago

dieandgo commented 5 years ago

hi all, i am new in all of this, i install temperature-machine and works great, but after a day aproximately sensor stop read and i have to disconnect raspberry to fix it. i see that memory becames full each time before crash. I made htop and i see temperature-machine process is occupying all memory, i restart it and start again until filling memory. what can be the problem?

tobyweston commented 5 years ago

Can you be more specific? Temperature-machine is unlikely to "crash" as such (quit unexpectedly) and as it runs as a service, it will attempt to restart if it were to.

It's more likely that the network disconnected, so when you say the sensor stopped reading, what did you observe exactly? Could you connect to the website? The sensor readings disappeared on the UI? How many machines are you running? Can you share the logs on each machine?

I'm not sure how to read htop but Java (which runs the temperature-machine) may allocate more memory than it needs and manage it. It may be that you're seeing what looks like a lot of memory being used but if you don't see "out of memory" in the logs, it's unlikely to actually be running out of memory.

My htop looks like this:

image

... and regular top:

image

dieandgo commented 5 years ago

hi. i have 1 sensor in 1 raspberry. my htop looks like yours. with more "java" items. this items uses a lot of memory. if i restart temperature-machine process it start from 300M. increassing until 500M. after some time in 500. finally sensor stop reading. it doesnt appear on temperature machine or home assistant like sensor.

if i restart raspberry sensor doesnt begin. if i disconnect raspberry from power. it returns to work.

i tried to stop process and memory stay at 200M. and sensor doesnt stop working anymore.

i have not many experience on this. sorry :S

tobyweston commented 5 years ago

As I say, Java allocates all that memory although doesn't use it. It shouldn't affect other processes or indeed temperature-machine. I think its a red herring 🐟.

Can you share the logs under ~/.tempeature?

ps. the htop output with lots of processes are actually child processes. Using top may give a clearer idea of how much memory is being used, mine showed 35%.

tobyweston commented 5 years ago

Looking at this again, I'm not sure setting the initial memory and max memory so high makes sense. Running free -h seems to show it uses a lot of memory so I may have been wrong before and it may be "hogging" memory.

They're set as 256mb and 512mb respectively (the logic of the later being the max memory available on the lowest spec Pi).

Running the Java defaults, leaves more headroom on the box and TM doesn't seem to need much more than 50mb.

Java Default (pi zero)

Screenshot 2019-08-30 at 12 15 17 Screenshot 2019-08-30 at 12 18 02

Current temperature-machine Default (pi zero)

Screenshot 2019-08-30 at 12 19 22

I'll run my setup with the Java (lower) defaults for a bit. If there's no problems I'll change it for v2.3.