Skip to content

[E][WiFiClient.cpp:212] connect(): socket: 105 when using Tasks #5072

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

Closed
maxdd opened this issue Apr 17, 2021 · 2 comments
Closed

[E][WiFiClient.cpp:212] connect(): socket: 105 when using Tasks #5072

maxdd opened this issue Apr 17, 2021 · 2 comments
Labels
Area: BT&Wifi BT & Wifi related issues Status: Stale Issue is stale stage (outdated/stuck)

Comments

@maxdd
Copy link

maxdd commented Apr 17, 2021

Hardware:

Board: ESP32 Dev Module
Core Installation version: 3.2.0+sha.b9530d3
IDE name: Platform.io

Description:

Hello,
I'm trying to speed up my code by adding 2 parallel tasks which are using "HTTPClient" to do one GET call each.
My main class is spawning the 2 tasks as such

    xTaskCreate(&GetInverterRealtimeData, // Task function
        "GetInverterRealtimeData", // Task name
        8192, // Stack size
        this,
        0, // Priority
        NULL);

    xTaskCreate(&GetMeterRealtimeData, // Task function
        "GetMeterRealtimeData", // Task name
        8192, // Stack size
        this,
        0, // Priority
        NULL);

the 2 tasks are doing something like this

    for (;;){
        //....
        lastMillis = millis();
        JsonDocument = httpGETRequest(serverPath.c_str());
        //parse Json
    }

the httpGETRequest is as follow

String httpGETRequest(const char* serverName)
{
    HTTPClient http;

    // Your IP address with path or Domain name with URL path
    http.setTimeout(20000);
    //http.setReuse(true);
    http.begin(serverName);

    // Send HTTP GETrequest
    int httpResponseCode = http.GET();

    String payload = "{}";

    if (httpResponseCode > 0) {
        //Serial.print("HTTP Response code: ");
        //Serial.println(httpResponseCode);
        payload = http.getString();
    } else {
        Serial.print("Error code: ");
        Serial.println(httpResponseCode);
    }
    // Free resources
    http.end();

    return payload;
}

What i'm experiencing is that after roughly 5-6 parallel calls i receive the following

[E][WiFiClient.cpp:212] connect(): socket: 105
Error code: -1

One time for Task1 and one time for Task2 and so on (in an alternate fashion)
The error should be this

#define ENOBUFS 105 /* No buffer space available */

but i've no idea what it is referring to

Regards

@maxdd maxdd changed the title [E][WiFiClient.cpp:212] connect(): socket: 105 Error code: -1 when using Tasks [E][WiFiClient.cpp:212] connect(): socket: 105 when using Tasks Apr 17, 2021
@VojtechBartoska VojtechBartoska added the Area: BT&Wifi BT & Wifi related issues label Apr 21, 2021
@stale
Copy link

stale bot commented Jun 20, 2021

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

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Jun 20, 2021
@stale
Copy link

stale bot commented Jul 8, 2021

[STALE_DEL] 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
Labels
Area: BT&Wifi BT & Wifi related issues Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

2 participants