-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ESP8266httpUpdate.update() incompatible with nginx #1157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Compiled with UPDATE_SERIAL Serial: Success (partial log): https://gist.github.com/skandragon/3b22582d3138009cf436 Failure (full log): https://gist.github.com/skandragon/7307d615b20c123ccfab |
Printing the error: [update] Update failed. I do not see any IP level fragmentation, so that's not an issue. |
I am starting to think the general state of TCP connections in ESPland is somewhat broken. My ultimate goal is to receive RGB data to drive LED arrays, and this will have to come in at a fairly high data rate. If I limit my data rate to one update per 0.5 seconds (each update consists of 6 bytes of data), then the ESP has no issue. My read is basically this: read a single byte command. With a low data rate, this works fairly well, but it will even then eventually have a short read. If I send at a high data rate, I can cause a short read to occur nearly instantly. In all cases, only 1 byte of the 5 is read, according to a The connection is entirely over a stable wifi connection; there should be no AP switching or dropping, but I'm not positive the ESP is as stable as I'd like it to be here. It is possible it's reconnecting, but I have no idea how to tell this. |
Socket read can return less bytes than you requested, there is nothing In any case, please open a separate issue if you find short reads a On Sun, Dec 6, 2015, 11:49 Michael Graff [email protected] wrote:
|
the ESP8266httpUpdate class itself handle only the requesting and header Interpretation. you can try to enable the debug: I think there are to possible reasons.
|
Looking more closely at the tcpdump when this first fails (not subsequent failures, which are tainted by left over internal state somewhere inside the ESPhttpUpdate class) I see this pattern: Server sends some number of bytes (1460 bytes usually) This happens every time there is an issue. It can take a while for the server to re-transmit the un-ack'd data, usually longer than the timeout for the read call, is my guess. I'm running a 10x second ping to the ESP, and I see no dropped packets. No other device, wifi or ethernet connected, has issues talking with the server running the nginx server. Local connectivity does not seem to be an issue. This is a tcpdump running from the wifi access point itself:
|
I'm having the same problem on a php-apache server. I've traced it down to this same line number in updater.cpp. The solution is over my head, but I can reproduce the problem 100% of the time. |
I've made some interesting progress... Try increasing the stream timeout to 10000 in writeStream in Updater.cpp size_t UpdaterClass::writeStream(Stream &data) { |
I have done some changes to the Update class to give the IP stack more time to handle the data. |
I have tested this new fix. for the most part it is working well. Thank you Links! The is still an issue with ESP.restart() seems to restart in bootloader mode. So it seems to require a manual reboot. |
the restart is a other problem see #1017 , but there is no solution yet. |
I am attempting to perform an upgrade from a server running nginx, and am having no real luck. It appears only some of the data is being transferred to the ESP, and I'm quite sure it's not a problem with nginx:
Here's a tcpdump of the last connection shown:
It works exactly once after a fresh reboot, but subsequent upgrade attempts fail even if that one succeeds.
I've attached a working tcpdump to https://gist.github.com/skandragon/47d4769ff988a3e1ce65 rather than put it inline here.
The text was updated successfully, but these errors were encountered: