Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: ESP8266
- Core Version: 2.5.0, 2.5.1, 2.5.2 and 2.6.0-dev
- Development Env: Arduino IDE
- Operating System: Manjaro
Settings in IDE
- Module: Wemos D1 mini
- Flash Mode: default
- Flash Size: 4MB
- lwip Variant: v2 Lower Memory
- Reset Method: ?
- Flash Frequency: ?
- CPU Frequency: 80Mhz
- Upload Using: SERIAL
- Upload Speed: 115200
Problem Description
While testing most basic UDP example I run across packet loss after an update of Arduino core. Don't get me wrong, I was eventually expecting some reliability issues with UDP communication, I am trying to send 4096 bytes. But after my tests, I got reliable packet loss with core version > 2.5.0. Using Board Manager I tested following versions and got this outputs in serial monitor (after using small python client, also provided in the issue):
2.5.0
Connecting to wifi. connected
Now listening at IP 192.168.0.150, UDP port 4210
Received 1472 bytes
Received 1480 bytes
Received 1144 bytes
Sums nicely to 4096.
2.5.1
Connecting to wifi......... connected
Now listening at IP 192.168.0.150, UDP port 4210
Received 1472 bytes
Received 1144 bytes
Middle one is missing.
2.5.2
Connecting to wifi. connected
Now listening at IP 192.168.0.150, UDP port 4210
Received 1472 bytes
Received 1144 bytes
The same.
2.6.0-dev (git master)
Connecting to wifi....... connected
Now listening at IP 192.168.0.150, UDP port 4210
Received 1472 bytes
Received 1144 bytes
Also the same. This results consist only first try, I ways resending the message multiple times, this 1480 bytes packet just reliably disappears.
I have everything set up for testing this issue, so if only you have some ideas to check, I would be happy to help.
MCVE Sketch
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
const char* ssid = "***";
const char* password = "***";
WiFiUDP Udp;
unsigned int localUdpPort = 4210; // local port to listen on
char incomingPacket[255]; // buffer for incoming packets
char replyPacket[] = "Hi there! Got the message :-)"; // a reply string to send back
void setup() {
Serial.begin(115200);
Serial.println();
Serial.printf("Connecting to wifi", ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println(" connected");
Udp.begin(localUdpPort);
Serial.printf("Now listening at IP %s, UDP port %d\n", WiFi.localIP().toString().c_str(), localUdpPort);
}
void loop() {
int packetSize = Udp.parsePacket();
if (packetSize)
{
Serial.printf("Received %d bytes\n", packetSize);
}
}
And small python sender:
#!/usr/bin/env python3
import socket
UDP_IP, UDP_PORT = '192.168.0.150', 4210
if __name__ == '__main__':
packet = ['0x00'] * 4096
message = b''.join(bytes.fromhex(p[2:]) for p in packet)
print(f'Sending {len(message)} bytes...')
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
s.sendto(message, (UDP_IP, UDP_PORT))