Arduino Yun stops executing sketch

I have an Arduino Yun and after a few hours it stops executing my sketch.

I can still get to the Yun via my browser but the only thing that will bring it back is a
reboot of the Yun.

Any ideas would be helpful.

I don't see a sketch.

Its the sketch provided RemoteYun

When a program crashes hard like you describe, it's usually a problem with memory: the stack filled up and had an overflow, a buffer was overrun, an invalid pointer was accessed, or all available memory got used up (often from a memory leak - memory allocated but never freed.)

I didn't analyze the code closely, but on a quick scan, this jumped out at me:

void readloop(){
  while (client.available()) {
    r =;
    if(r=='!') break;
    readed +=  r;      
  if(client.available()) readloop();

The function readloop() is recursively calling itself. If another command starts to come in during the time it takes check_command() to process a command, it will re-enter readloop(), adding another call context on the stack. If this keeps happening, the stack will fill up and the sketch will crash. The Linux side will still be running, so it makes sense you can still access the Yun from your browser.

This is a poor design right at the core of the program. I wouldn't be surprised if there are other issues with the code.

The moral of the story: anybody can post code on the Internet, and just because it's posted it doesn't mean that it's good code or that it works in all situations.

Thank you. That would make a lot of sense.