sirleech / Webduino

Arduino WebServer library
748 stars 264 forks source link

Stall whith long latency links #40

Open agnunez opened 11 years ago

agnunez commented 11 years ago

What steps will reproduce the problem?

  1. Use standard demo with /form url for digital output control through radio buttons
  2. Use a long latency connection, like radiolink in my case
  3. reach latencies of pings beyond 3.0 ms or more

What is the expected output? What do you see instead? It works sometimes until latency rise over a threshold (unclear which one). Then the http response never arrives. I tried firebug and Chrome with no console errors, just stall (pending response). It happens to a bunch of them simultaneously (they run on different ports on the same LAN, so no hardware specific problem. (both UNO and Ethernet models).

What version of the product are you using? On what operating system? Latest sirleech/github version of webduino library on ArduinoUNO plus Ethernet shield, or Arduino Ethernet (both tested). All of them are being used with Ariadne bootloader for remote IP reprogramming.

Please provide any additional information below: While the Arduino is in stall mode, any ping or LAN (local without radiolink) http request are served without problem (you get back full form functionality and digitalbits changes).

Any hint how to at least respond with timeout error will be welcome, as these arduinos will run on an unattended remote location. Any other experiencing the same behaviour, please report your findings.

Thanks, Agustin

unwiredben commented 11 years ago

Have you modified the WEBDUINO_READ_TIMEOUT_IN_MS value in WebServer.h to increase the timeout from 1s (1000ms)?

agnunez commented 11 years ago

Hi, thanks!

Yes, I tried even 5000ms but no help. It is curious that while an http transaction is pending from the radiolink (stall), I can curl from same LAN location with a local linux cpu and have the correct response (form, json, etc..).

Is there any way to debug which transaction is pending inside the code? I can try to insert serial logs everywhere but perhaps you have already that in the code.

Thanks, Agustin

unwiredben commented 11 years ago

The webduino code is completely serial. It doesn't handle multiple requests at a time, so if you're able to connect locally, it means the Ethernet shield has already dropped the other connection.

I suspect the Wiznet chip is just dropping things with the high latency, perhaps before it even alerts the library. Unfortunately, the Arduino's ethernet library doesn't provide access to the remote IP, so if you want to add some serial logging, you'll need the two links to request different URLs to tell them apart.

On Tue, Jun 4, 2013 at 6:50 AM, Agustin Nunez notifications@github.comwrote:

Hi, thanks!

Yes, I tried even 5000ms but no help. It is curious that while an http transaction is pending from the radiolink (stall), I can curl from same LAN location with a local linux cpu and have the correct response (form, json, etc..).

Is there any way to debug which transaction is pending inside the code? I can try to insert serial logs everywhere but perhaps you have already that in the code.

Thanks, Agustin

— Reply to this email directly or view it on GitHubhttps://github.com/sirleech/Webduino/issues/40#issuecomment-18904080 .

agnunez commented 11 years ago

Thanks again, Ben.

I have consistent errors on different ArdUNO hardware (5 units) when accessing externally through a long latency link with the /form demo. Now it gets totally hang and after that not other local connection it's possible. It does not happen locally, of course, as I did test it for months with 10 browsers requesting every second, without a glitch. Another source of potential problems is Ariadne Bootloader, (necessary for remote update), but I will report that on its wiki. I developed a simplified version of your demo, without web interaction just with a post transaction with pin switches as parameters that its working even on the long latency enviroment, so I will use that an avoid web browsing. So the source of problem seems the response. I test also a code with multiuser authetication and is working locally but not remotely. I will share all this code on github as soon as a finish a working enviroment.

Thanks, Agustin

agnunez commented 11 years ago

Is there a way to reset the stalled connection from the code, without reseting Arduino from scratch. The reason, I can implement a watchdog code that trigger when arduino stall (ping timeout to the router), but that is useless in my case, as these ardu'st control some relays that with a reset would be switching off and power down some controlled equipment. So I need just to clean and reset the ethernet open connections, but without reseting the whole sketch. Best way?

Thanks, Agustin

unwiredben commented 11 years ago

All I've seen is hacks like the one at http://www.instructables.com/id/Arduino-home-energy-monitor-shield/step5/Mod-the-Reset-Pin/ that connect the reset line to a digital pin.

On Mon, Jun 10, 2013 at 5:17 AM, Agustin Nunez notifications@github.comwrote:

Is there a way to reset the stalled connection from the code, without reseting Arduino from scratch. The reason, I can implement a watchdog code that trigger when arduino stall (ping timeout to the router), but that is useless in my case, as these ardu'st control some relays that with a reset would be switching off and power down some controlled equipment. So I need just to clean and reset the ethernet open connections, but without reseting the whole sketch. Best way?

Thanks, Agustin

— Reply to this email directly or view it on GitHubhttps://github.com/sirleech/Webduino/issues/40#issuecomment-19190715 .