I’m having a nice time developing with WiFly Sheild Library, but occasionally it will hang a connection or stop accepting new connections. I can reproduce the issue using WiFly_WebServer, to give a common baseline.
It seems the issue is known, from the README:
This is an alpha release–this means it’s non-feature complete and may
not be entirely reliable. It has been tested with the shipped examples and
works in most cases.
There are some known issues:
- There are some situations (exact cause unknown but often it seems
to be after initial programming) where the WiFly will fail to
respond to requests. You may need to power-cycle the Arduino or tryrefreshing the page in your browser if it’s acting as a server.
- There’s a limit to how quickly you can refresh a page when acting
as a server–this is because the library doesn’t handle dropped
connections well at present. You can generally tell from the lights
on the unit if it’s busy. (This is particularly obvious when ausing a web browser (rather than something like ‘wget’) because
after the page is loaded the browser makes an immediate request for
the favicon. Once every five seconds or so should be fine depending
on how big the page is.
- The code isn’t very robust for error states–in general it will
hang rather than return useful information.
I’m not sure which, if any, of these are my issue–but it sounds a lot like the first point.
I have 2x of the same setup, and the observations are the same on both:
Arduino IDE 022
Latest WiFly Sheild Library code: GitHub 981ea950b0d0f382e52da18fd54fa872b56b632c
Arduino UNO R2
WiFly Sheild R3
In short, here’s what I see:
-
Same/similar results if I upload the sketch via USB and it boots OR I power it on from AC
-
I make several HTTP requests, sometimes as few as 4 kill it, sometimes it takes hundreds
-
When it’s in the hung state, the green light on the WiFly blinks
-
Sometimes when it hangs the red light flashes when I make a connection/request to it, but the client just hangs
-
Other times it seems to recover after a single hung request. As the last connection is hanging, the green light is steady and goes to flashing after I hit ctrl+c on curl
In some sense it seems like I see two failure modes: one that will accept more connections (4), and one that is permanently broken (4).
Thanks in advance for any advice.