Crashing server, unable to trace whats reason

Hi guys,

I’m playing around with a zoomkat web server/client code I found on this forum. Currently I added couple of subroutines that that turn on couple of LEDs and a PC cooler, and subroutines to read time and temp data from RTCDS1307 and BMP280 respectively. It all works fine until certain point. So far it seems to be random, although I honestly don’t believe it is from little experience I have. I must be doing something wrong but I’m not sure where to start debugging it.

I tried using serial print before and after entering and exiting certain subroutines but this left with me with all subroutines (time and temp) getting hangs before arduino freezes (w5100 Ethernet shield too, tried pinging it, sometimes I get response sometimes no response).

Is there something obvious I’m missing that is causing the crashes. I know that I’m not interrupting actions, but for now I’m happy with sometimes having to wait for certain reaction, I’m more interested into what causes it altogether to stop/freeze and it’s annoying because this shouldn’t be too much to handle, or correct me if I’m wrong?

EDIT1: I can sometimes ping the Ethernet even after it stops iterating the subroutines.

I would appreciate any constructive help or guidance on how to start debugging in the right direction. Thanks.

testDokaR21S.ino (12 KB)

When it "crashes" have you tried waiting an hour or a day to see if it comes back to life?

You should change your responses to "HTTP/1.0". By default HTTP/1.1 assumes a persistent connection and it might be that previous requests to the W5100 is clogging up its connection limit of four connections (IIRC).

Hi, thanks for the reply.

Chagrin:
When it "crashes" have you tried waiting an hour or a day to see if it comes back to life?

You should change your responses to "HTTP/1.0". By default HTTP/1.1 assumes a persistent connection and it might be that previous requests to the W5100 is clogging up its connection limit of four connections (IIRC).

the most I've tried to wait for it was cca 30 minutes, I'd usually reset Arduino after that much time.

I'll give it a try now and see if it changes anything.

cheers