Raspi crashing? or php not running correctly from cron

If i leave the raspberrypi_run.php to run on the cronjob it crashes, randomly (feeds stop and the lights stop flashing on the RFM12Pi board) this happens at random, but it rarely makes it over 24hours.

The Pi is still responding fine but the raspberrypi_run.php needs killing with a kill -9

If however I delete the cron entry and then run raspberrypi_run.php from a command line it is fine and runs forever?

I have just tried a new SD card.....same results.

I have made some very minor tweaks to the raspberrypi_run.php file but why would it only run from command?

Any ideas how to debug this further?

 

 

 

Jérôme's picture

Re: Raspi crashing? or php not running correctly from cron

Can you see anything in the logs ?

Do you use the "send time to emonGLCD" feature ? It is known to trigger such a bug, although it would affect the script whether launched from command line or through init file.

mattnj's picture

Re: Raspi crashing? or php not running correctly from cron

yes, I have recently added the "send time to emonGLCD" so that must be it....

is there a fix somewhere or the cause explained.

TrystanLea's picture

Re: Raspi crashing? or php not running correctly from cron

The cause we think is because the ATtiny has some bug in its serial library that sometimes receives a corrupted command from the raspberrypi which then mistakenly sets the frequency or group id to an incorrect value, a whole lot of checking was added to the raspberrypi_run script to try and catch when this is happening and change the settings back to the correct value. Unfortunately it doesn't work every time and so it can lock up. The best thing is to reduce the rate at which you send time updates to say 5-10 mins or slower. This will reduce the likelyhood of lock ups.

This issue does not occur on the new rfm12pi board as it uses an atmega328 rather than an attiny for which the serial library works better/fully

Jérôme's picture

Re: Raspi crashing? or php not running correctly from cron

A workaround is to lock the settings (use minicom to send "123", I lack time here, but you should find info about that). There is no GUI to do that, minicom only. And the GUI won't be aware so it will still offer you to change settings, they'll just be ignored by the radio module.

Not much interest developping a better workaround as the new hardware makes the serial link reliable.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.