0

raspberry pi hangs after not using for 1-2 days, then we have to forcibly reboot or restart the device. I have connected hardware of magnetic door lock, relay, RFID and Dual smps to the raspberry pi. But I cannot recognize the issue of why it is hanging when it is not used for 2 days. please suggest some solutions to fix the issue.

tlfong01
  • 4,665
  • 3
  • 10
  • 24
Kumar
  • 31
  • 1
  • Is 1-2 days very regular, or sometimes as short as 1 -2 hours, and sometimes as long as 3-4 days? If it is regular, then something is "leaking", as common in Windows servers. – tlfong01 Apr 24 '19 at 06:12
  • Divide and conquer. Disconnect all the hardware, see if it still happens. If it does, it's software, if not, it's hardware. Whichever is the cause, divide that in two and see if the problem still happens - for example connect half the sensors, or run "half" (or "some of") the software (for example the operating system but not your custom programs). – Mark Smith Apr 24 '19 at 08:38
  • I'd suspect a memory leak in your code somewhere. – Dougie Apr 24 '19 at 21:48
  • @Dougie how to verify if it is a memory leak? – Kumar Apr 29 '19 at 07:48
  • Run the free command every minute and log the results. You can do that with a root crontab line */1 * * * * /usr/bin/free >> /var/log/freemem.log. – Dougie Apr 29 '19 at 11:25
  • @Dougie first which line has to be executed ? could you post the steps to be followed? I am unable to run those command line, I got stuck. – Kumar May 03 '19 at 05:28
  • Run sudo crontab -e then add that funky line starting with */1. Save the crontab and wait until the machine crashes again. – Dougie May 03 '19 at 07:18

0 Answers0