Skip to content

Maybe an Important Bug found in WifiClient #2087

@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 ?

Activity

Jeroen88

Jeroen88 commented on Jan 2, 2019

@Jeroen88
Contributor

@lzw7603 you are right, I found the same problem and created PR #2259 to solve it

stale

stale commented on Aug 1, 2019

@stale

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale

stale commented on Aug 15, 2019

@stale

This stale issue has been automatically closed. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Maybe an Important Bug found in WifiClient · Issue #2087 · espressif/arduino-esp32