Web server client doesn't respond after a few requests

This is from one of their own example codes for WiFi101.h which can be seen at https://www.arduino.cc/en/Tutorial/Wifi101WiFiWebServer .

I have a MKR1000 board which I put this example sketch on, when it runs it of course refreshes ever 5 seconds like the HTML header expects it to.

The first few work fine, and watching the serial monitor everything works as expected... then suddenly chrome starts to spin like it's waiting for a response, check the serial monitor and it's stuck at "new client" and does not move past this point.

If I press F5 to do a refresh it usually works again but then after a few refreshes again it's once again stuck at "new client"

does anyone else see this or able to reproduce this? I was seeing a similar issue with other code on the ESP-01 chip, which was one of the reason I started testing the MKR1000 chip (which does work better for what I'm intending to use it for) but these random lock ups on the the server component are getting in the way

Is something missing? a buffer not being flushed? connections not being close? This is just the example project I am able to reproduce this on so it should stand out pretty well.

That means that the client opened a connection to the server but didn’t send an HTTP request. I you didn’t provide more information any hint would be pure speculation.

Is something missing? a buffer not being flushed? connections not being close? This is just the example project I am able to reproduce this on so it should stand out pretty well.

We don’t know. Post the complete serial output you got up to the freezing. Maybe we see something there.

From other threads I see some indications that the WiFiNINA hardware might loose some packets but that’s far from being proofed.

Tried another example... this time the simple web server that turns the led on and off... here's the output

Serial:

SSID: xxxxxxxxxx-LAN
IP Address: 192.168.1.111
signal strength (RSSI):-62 dBm
To see this page in action, open a browser to http://192.168.1.111
new client
GET / HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /H HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://192.168.1.111/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /favicon.ico HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: image/webp,image/apng,image/,/*;q=0.8
Referer: http://192.168.1.111/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /favicon.ico HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: image/webp,image/apng,image/,/*;q=0.8
Referer: http://192.168.1.111/H
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /L HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://192.168.1.111/H
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /favicon.ico HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: image/webp,image/apng,image/,/*;q=0.8
Referer: http://192.168.1.111/L
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /L HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://192.168.1.111/L
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /favicon.ico HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: image/webp,image/apng,image/,/*;q=0.8
Referer: http://192.168.1.111/L
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
SSID: Mansfield-LAN
IP Address: 192.168.1.111
signal strength (RSSI):-62 dBm
To see this page in action, open a browser to http://192.168.1.111
new client
GET / HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /H HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://192.168.1.111/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /favicon.ico HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: image/webp,image/apng,image/,/*;q=0.8
Referer: http://192.168.1.111/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /favicon.ico HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: image/webp,image/apng,image/,/*;q=0.8
Referer: http://192.168.1.111/H
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /L HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://192.168.1.111/H
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /favicon.ico HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: image/webp,image/apng,image/,/*;q=0.8
Referer: http://192.168.1.111/L
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /L HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://192.168.1.111/L
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client
GET /favicon.ico HTTP/1.1
Host: 192.168.1.111
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Accept: image/webp,image/apng,image/,/*;q=0.8
Referer: http://192.168.1.111/L
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

client disonnected
new client

and at that point it stops responding until you force a refresh

at that point, the chrome browser is stuck on this request

headers of request:

Request URL: http://192.168.1.111/H
Referrer Policy: no-referrer-when-downgrade
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Host: 192.168.1.111
Referer: http://192.168.1.111/L
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36

while that chrome request is spinning waiting for something from the server, no other request work, the CPU is currently in a blocking state, as soon as you cancel the request execution resumes

It's usually 3-5 HTTP GET requests in a row that cause this block...

code that is running in this test is the example code below:

SimpleWebServerWifi for WiFi101

going by the logs in chrome it opened a connection and did sent a HTTP GET request, but its like the server didn't like it or never got it

The problems probably is that Chrome is requesting the content using HTTP/1.1 and the example sketch is answering as it would support HTTP/1.1 but it doesn’t even follow the HTTP/1.0 standard. Chrome is asking for a keep-alive connection so it probably keeps the TCP connection open much longer than expected. My guess is that it sends that last request using the connection of the previous request for favicon.ico. As the Arduino doesn’t look at that connection once it responded it doesn’t see anything of that request.

Sniff the traffic between Chrome and your Arduino, so you see what request is sent in which TCP connection.

I would first try to change the sketch so it doesn’t pretend to support HTTP/1.1 although it only supports a tiny subset of HTTP/1.0. That might already help as it directs the browser to not reuse a connection without explicit order from the server.

If that doesn’t help, post the output of the sniff (WireShark is the tool of choice for such tasks).