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.

  • 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 6: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 8: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 7: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.