-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
TCP/IP subtly broken on Opta (and possibly other platforms) #978
Comments
could you try this changes https://github.com/arduino/ArduinoCore-mbed/pull/912/files ? |
Sometime, other times some parts are just missing. The code in the change you linked still has a ArduinoCore-mbed/libraries/SocketWrapper/src/MbedClient.cpp Lines 208 to 216 in 103d4ab
I don't know if that's related to the problem but not checking for specific non-blocking error codes seems suspect to me.
No, I just tried older and older cores until I found one that didn't show the problem.
Sure. You will have to setup some kind of server (HTTPS is better because the problem is more evident) and dump everything received (I use Nginx to terminate the SSL and forward the connection to a netcat):
|
Sorry but I am in no condition to setup an mbed development environment and build the core from scratch right now. |
those changes are in the Arduino library |
got it. I've removed the I will try to setup a test and reproduce the issue |
Is |
The result of the get is a 200 bytes JSON file (generated on the fly by the server). When we received malformed headers the server just send back a "400 malformed request" error and in both cases (OK or error) we always consume the full body of the response. I don't think the problem is related to how we use the HTTP library because it sometimes happens on the first request after resetting the Opta. Also, we did some tests using a plain
|
Yesterday I've made some test with the EthernetClient but I was not able to reproduce it. I will try again today doing multiple resets and adding the check on the write size. |
Pretty sure I was experiencing this as well. Don't have easy access to the server to see what was actually happening, but five out of five opta's updated to 4.1.6 last week started failing about 50% of https POST calls, with server returning an error indicating the headers or data payload were not in-spec. (http 415 in my case.) One device connected to a different network started experiencing >90% failure, POSTing the same payload. Success or failure seems random. Downgrading to 4.1.3 gets at least one Opta back to 100% success. I'll try others in the next 24 hours. |
Can you tell me how am I supposed to test the PR? I don't have a clear idea about how to replace the current core as downloaded via arduino-cli. It is possible to just clone the repository and use it to build a test program from a sketch? |
Yes, you can do it following the instructions in the README https://github.com/arduino/ArduinoCore-mbed?tab=readme-ov-file#installation After you should see an additional core listed in the IDE or arduino cli
You can use this commit 944572f since I've force pushed the PR to get the patch merged |
@fogzot @jbfraser1 release 4.2.1 includes the fix for this issue. I'm closing this. |
Some changes done after 4.1.3 introduced a very subtle bug that garbles the data sent over TCP/IP, for example using
HttpClient
. When using the following code:sometimes on the server side we receive partially corrupted content:
Note the
X-DNDG-FirmwareVersion2:
line, that should have beenX-DNDG-FirmwareVersion: 2
. This happens more frequently when using an encrypted connection but also happens when using a plainEthernetClient
(so it is not caused byHttpClient
). Also, this happens more frequently when sending "large" payloads (> 100 bytes) in a short period of time.We think this broke when the sockes writes were switched from blocking to non-blocking to address the "ethernet disconnected" problem without explicitly checking for the
EAGAIN
result to correctly retry and serialize the writes.The text was updated successfully, but these errors were encountered: