Skip to content

Maybe an Important Bug found in WifiClient #2087

Closed
@lzw7603

Description

@lzw7603

Hardware:

Board: ESP32 Dev Module
Core Installation/update date: 11/NOV/2018
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Windows 10

Description:

the code in /libraries/WiFi/src/WiFiClient.cpp line 74
"_fill += res;" run after that the value "_fill" will be -1 sometime.
because the code in /libraries/WiFi/src/WiFiClient.cpp line 70
"if(res < 0 && errno != EWOULDBLOCK) {" the res will be -1 sometime

and it will make the code in /libraries/WiFi/src/WiFiClient.cpp line 106
"*dst = _buffer[_pos];" the value "_pos" will larger than "_size" (default 1436) where is the size of the _buffer.
and then the code will go crash and output an info like "Guru Meditation Error: Core 1 panic'ed (LoadStoreError)...."

now, i fix it by adding some code like
"if(res < 0) return res;"
before
"_fill += res;" in /libraries/WiFi/src/WiFiClient.cpp line 74
an it running stable for a long time.

this happen frequently in downloading a large file(more then 1M) with http get.
my situation is :
HTTPClient http;
http.begin(“http://192.168.1.100:49315/xxx.bin”);
int code = http.GET();
WiFiClient *tcp = http.getStreamPtr();
while(remaining())
{
tcp->readBytes
}

so, is it a right fix?
what is the meaning of the "if(res < 0 && errno != EWOULDBLOCK) {" in /libraries/WiFi/src/WiFiClient.cpp line 70 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions