2

I am running the newest version Linux raspberrypi 4.1.10-v7+ #820 SMP PREEMPT Sun Oct 4 16:26:51 BST 2015 armv7l GNU/Linux on an RPi 2,

And when I read the temperature pf the CPU though any method my system eventually completely crashes.

I've tried cat /sys/class/thermal/thermal_zone0/temp and vcgencmd measure_temp and I even tried a python script like this:

f=open("/sys/class/thermal/thermal_zone0/temp")
while True:
    f.seek(0)
    temp=f.read()
    #do something

but they all eventually crash my RPi so bad that all of the lights (ACT and PWR) and my wifi card LED just stay on, no flashing nothing. After that I can just unplug it, plug it back in, and be good to go.

Is there any fix for this? A way to prevent it?

Jacobm001
  • 11,898
  • 7
  • 46
  • 56
Patrick Cook
  • 6,365
  • 7
  • 37
  • 63
  • Do you have Jessie or Wheezy? – Kachamenus Oct 07 '15 at 03:45
  • Hmmm.... never heard of anything like this. Just curious, do you have the luxury to download NOOBS again (or just raspbian) and install it on the Pi again? If not, just try: Sudo apt-get update Sudo apt-get upgrade Then try it again. My reasoning was you just ran into a bug. If you're using Jessie, well Raspbian Jessie is relatively new. You can report the bug here. – Kachamenus Oct 07 '15 at 03:47
  • @Shojan I am using Wheezy, and I just updated yesterday. Also this is a very common bug. – Patrick Cook Oct 07 '15 at 04:19
  • Are you consuming a resource you are not releasing in do something? – joan Oct 07 '15 at 07:47
  • @joan Nope, just print. – Patrick Cook Oct 07 '15 at 15:43
  • @PatrickCook is there a time.sleep(0.001) or similar in do something? I'm not sure how or whenPython garbage collects the old temp variables. – joan Oct 07 '15 at 16:48
  • @joan yep, a sleep(5) – Patrick Cook Oct 07 '15 at 17:19
  • Are you using some kind of GPIO pin? Because this situation i faced when i am not give good power supply ie. 5v and due to which it crash and i need to re plug all again. – RahulAN Oct 08 '15 at 12:22
  • I am using an LCD screen attached to 5v, but I have a 2A power supply and another 3A powered USB hub attached, there is no way I am using more than 5A – Patrick Cook Oct 08 '15 at 17:33
  • When you say "completely crashes" does that mean a kernel panic? Do you get a stack trace on the console? If so, post it here and someone can give a better answer... – Brian Oct 10 '15 at 20:13
  • @Brian, nothing, it just fails, no trace of anything suspicious in any of the logs. – Patrick Cook Oct 10 '15 at 22:12
  • Have you tried opening and closing the memory file every time the loop runs? – Jacobm001 Jan 01 '16 at 06:43
  • 1
    @Jacobm001 Yah, I read up on it and its just a problem with Debian Linux. – Patrick Cook Jan 01 '16 at 07:31
  • Mind putting in an explanation as a self answered question then? It would help people who may have the same problem in the future. – Jacobm001 Jan 01 '16 at 07:32

1 Answers1

1

Nearly three years later, I'm answering this question even though I answered it in the comments and this is a dead operating system:

According to a discussion on the raspberry pi forums, this is simply a problem with the OS. Since the system itself reads the temperature every so often for various purposes, it becomes increasingly likely with time that my script and the system will try to access the temperature file at the same time, causing it to hang.

So, in short, not a fixable issue.

Patrick Cook
  • 6,365
  • 7
  • 37
  • 63