-
Notifications
You must be signed in to change notification settings - Fork 13.3k
HTTP client gets randomly stuck, with its stream's available() returning 0 almost forever #5139
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
@teo1978 when you opened this issue, you were presented with an issue template that contains specific instructions and requested info. You have ignored this. |
Yep, I have provided the information that I have, and that I had the time to provide. Whether or not you are willing to do something with it is, of course, entirely up to you. |
It's not about what I do with the info, as this is not a service provided to users, but rather a community effort. The issue you encountered affects you, so you're the primary interested party for pursuing a fix. If you don't have the time to follow the minimum instructions in the issue template, then reporting this was just a waste of your own time, as well as mine. |
Exactly, this is not a service provided to the user and I am not here asking for help. I am reporting an issue hoping this helps the developers (or any contributor) fix it and hence improve the library. I provided as much information as I have and spent as much effort as I am willing to spend. It may be useful or it may be not. I don't expect anybody to step in right away and start looking at the issue and fix it. I don't think closing the issue would be a sensible thing to do either, but that's up to the criteria of whoever maintains the project.
I am an interested party; the abovementioned community, as well as anybody using the library, also are. Who is more interested than anybody else, I don't know and I don't think is of any relevance.
I'll probably do that when I get some time to: after all, as you said I am interested in getting this fixed, or even just in digging into it enough to find a workaround. Or somebody else might also be willing to do that. |
Ok, so I have done the work you so kindly asked me to do, and here's a complete, minimal (as minimal as I could) and reproducible sketch with a real example URL. It's an Arduino sketch that I am opening with the Arduino IDE and testing on a Sparkfun ESP8266 "Thing Dev", but should work on other Arduino-compatible ESP8266 board, I guess. I hope that's ok. NOTE: you need to replace The code is at the end of this comment. To me, it reproduces the issue pretty frequently. Sometimes it behaves as expected, sometimes it exhibits the issue just a little bit, and sometimes to the point that it goes on forever. (and occasionally it fails to connect with the -1 error code which is supposed to mean "connection refused" which I'm pretty sure is bull****, but that's another story). The expected output would look like this:
Occasionally, in the middle of that, you may expect to get very few occurrences of this:
When the issue happens, you get something like this:
(and after literally several minutes it may even manage to finish downloading!!) Regarding the code, I know it could be cleaner. The reason i have not made it even simpler is that I need to print some debugging information of what's happening, but at the same time I want to avoid speeding down the download significantly because of all the serial output, in case speeding down the client interferes with the download itself. So I try to print messages only when either I have accumulated a few downloaded kB's, or a couple of seconds have passed with no available data.
|
@teo1978 there we go! That wasn't so hard now was it? |
Notes: |
Nope, which is why I din't think you needed me to do it.
Ok, will do tomorrow
I guess those notes are not for me, are they? |
2.4.0, I got it via the Arduino IDE's Board Manager.
As I said it's this board: That's all I know. |
Would you please at least try 2.4.2 ? |
Sorry, I have installed 2.4.2 now and I keep observing the same behavior. (do you? have you tried it??)
I'd be happy to but I'm not sure how to do that, as I usually install the library through the Arduino IDE's Board Manager. Not sure if I can just download the git version and simply overwrite the currently installed one with it? |
Well the documentation is far from perfect, but did you read this https://github.com/esp8266/Arduino#using-git-version ? |
@teo1978 How to try
Revert to master:
In case of updates in the PR, do this before restarting the above.
|
Sorry, I intended to mark as duplicate of #4176 (maybe I can't do that). I thought I would get that option and if not, a confirmation prompt when closing where I could cancel. Anyway, it does seem to be that issue. I am testing the PR and will report there. Thank you. |
I have the following code (I have simplified it to post it here) that downloads a file from an URL and streams it to some physical output.
I read the downloaded data a few bytes at a time and use it as I download it beacause it's to big to store into the RAM (around 250 kB).
What happens is that often, randomly,
httpstream->available()
starts returning always 0 for very long periods of time.This is not a network issue or a server issue, as I have never, ever observed anything like this on any kind of http client before.
The expected output would be lots of
Got some bytes
and someNo bytes available
from time to time, eventually resulting in downloading the whole file.The observed result is either:
No bytes available
, with someGot some bytes
from time to time, so the download is extremely slow, but eventually succesfully finishes, or it suddenly "wakes up" and resume normal speed (i.e. I stop getting "No bytes available" and get mostly "got some bytes" until the end)or
No bytes available
forever, until eventually the connection gets closed, sohttp.connected()
return false and breaks the loop, without finishing the download.P.S. until this is fixed, suggestions for a workaround would be highly appreciated.
The text was updated successfully, but these errors were encountered: