-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Byte error in transmission using "responses::FileContentResponse" #159
Comments
As a first step I checked the data being read from the SDcard by implementing an analysis of read data; here I simply counted the zeros read from the file (knowing that the XML file does not have any zero). With this modification I have the following observations:
|
Since I had the suspicion that it is somehow related to a timing problem (see previous post), I modified the timeout for the |
Oh-boy, this could be anything. I agree that lwip is likely not to blame, and probably not the SDCard either. The only way to find the cause is to do what you've already begun - a systematic trial and error. I'd setup a test on the host with a HTTP server that generates (i.e. purely in-memory) a sequence of bytes of different lengths (from small to large) that can be verified on the receiving end. Each sequence should preferably be reproducible such that the entire test can be repeated. If I don't remember wrong, there's something among the examples that does something close to this. |
In the examples there is a test with multiple file uploads (from PC to ESP32). But here the problem occurs in the opposite direction (from ESP32 to PC). Currently I encounter this problem not so often - maybe every 10th or 20th transmission of a large file. For the time being I can live with it but later I definitely need to fix it. |
Currently I am transmitting an XML file (size approx. 700kB) via
responses::FileContentResponse
from SDcard to the Browser using a REST request/response. In the Browser I process this file usingDOMParser()).parseFromString(str, "text/xml")
. Approx. every 3rd transmission I get an error message from this parser saying:I analyzed the wireshark trace on some malicious transmissions and found out that on arbitrary positions in this file a character is corrupted; example: in the word "protocol" the last "o" (hex: 0x6F) is being replaced by 0 (hex: 0x00).
Now I am asking myself where this problem comes from. Currently I see the following possibilities:
The error might arise while reading the file from the SD card. Until now I did already many activities with reading files from the SD card and I never saw such an issue. So I think this root cause is not very likely.
I guess the
responses::FileContentResponse
is also being used when transmitting plain HTML pages. Since simple HTML pages seem to work quite well (until now I never saw a problem here), I think also this root cause is quite unlikely the reason.Since lwip is very widely used I don't consider any specific problem here.
AFAIK TCP/IP tranmission has integrated crc checks. Additionally I don't see any other issues in my local network. So I guess this also is not the problem.
Having these possible root causes in mind I currently don't know which one is more likely. Or do you see other possible root causes which I did not consider until now? Do you have a suggestion where I should investigate first?
The text was updated successfully, but these errors were encountered: