Skip to content
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

ESP32 BLE/WiFi throws an error [E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes" - still not resolved #6129

Closed
1 task done
sudheeshsmadhav opened this issue Jan 12, 2022 · 84 comments
Assignees
Labels
Area: WiFi Issue related to WiFi Status: Pending Merge Pull Request is ready to be merged

Comments

@sudheeshsmadhav
Copy link

Board

ESP32 devkit v4

Device Description

I am using ESP32 devkit v4

Hardware Configuration

no GPIO connections, ESP32 scans the BLE tags and sends their id and rssi values over mqtt

Version

latest master

IDE Name

Platform IO also uses arduino IDE 1.8.57.0

Operating System

Windows10

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

115200

Description

ESP32 scans the available BLE tags and publishing the collected information over mqtt (Raspberry Pi 4 B is the broker). It was working fine in the last month.
now it started to print error in the console something like [E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes" and after some time it restarts. BLE scan runs in a freeRTOS task. MQTT publishing is in loop().

it works fine for around 5min(time interval is random) then fails and reboot as the log mentioned.

[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 113, "Software caused connection abort"

Sketch

will provide if requested.

Debug Message

[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes"
[E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 113, "Software caused connection abort"
PUB Result: 0
number of uploads: 153

ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@sudheeshsmadhav sudheeshsmadhav added the Status: Awaiting triage Issue is waiting for triage label Jan 12, 2022
@MomePP
Copy link

MomePP commented Jan 16, 2022

I also got this error but in my case, it's a Wi-Fi AP as webserver by using WiFiManager. After started webserver, ESP writing response to client. This error showing up then crash.

This only happended with latest release(2.0.2). Downgrade to 2.0.1, It works fine.

@BeaverUI
Copy link

I have exactly the same issue with my code. I use MQTT, BLE, and WiFi together on an ESP32. It runs for a while, and then resets at a quasi-random time.

@MomePP: I didn't get your comment, I believe the WiFiClient is in the board definitions file, and no version 2.0.2 there. Or am I missing something?

@sudheeshsmadhav
Copy link
Author

I didn't use the WiFiManager. h

#include <WiFi.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <ESP32Time.h>
#include <WiFiUdp.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEScan.h>
#include <BLEAdvertisedDevice.h>

I use only these files in my code

@BeaverUI
Copy link

I have these:

#include <WiFi.h>
#include "BLEDevice.h"
#include <ESPmDNS.h>
#include <ArduinoOTA.h>
#include <MQTT.h>
#include <WiFiClient.h>

Different MQTT library, by the way.

@MomePP
Copy link

MomePP commented Jan 22, 2022

@BeaverUI

Sorry for the confusion. What I mean is version of ESP32 Arduino Core that i used and WiFiClient is part of definition file in WiFi library.

In my case i used WiFiManager library, which is based from WiFi library. So i got the same issue with WiFiClient.
However, I didn't use BLE.

@BeaverUI
Copy link

BeaverUI commented Jan 22, 2022

Thanks, I changed to 2.0.1 now, let's see what happens. It usually takes less than 24 hours before it throws the error.

@BeaverUI
Copy link

Oops, it did it again. Changing the Arduino Core made no difference. What I notice is that some processes seem to struggle:

  • My mqtt broker sometimes gives a timeout on the connection to the ESP
  • WiFi on the ESP sometimes reconnects
  • BLE on the ESP sometimes throws an error
  • The available heap decreases continuously, but I can't find any leaks in my code. When doing scans only, without connecting, there is no leak.
  • After a while the ESP reboots or freezes, which is at a random moment but always seem to align with the moment that BLE is active.

@sudheeshsmadhav
Copy link
Author

Hi, changed some library files and their versions. Still the issue available. Anybody identified any possible solutions? I reinstalled the Arduino ide, tried different versions of library files. No use... It is still makes me mad.

@sudheeshsmadhav sudheeshsmadhav changed the title ESP32 BLE/WiFi throws an error [E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes" ESP32 BLE/WiFi throws an error [E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes" - still not resolved Jan 31, 2022
@sudheeshsmadhav
Copy link
Author

Not a permanent solution but some how I am able to handle it. I am repeatedly sending data from esp to server, So this problem made some gap in the communication. As the error printed - [E][WiFiClient.cpp:395] write(): fail on fd 54, errno: 11, "No more processes" , I am able to point out the error code in the wificlient.cpp file. Upon printing the log, I made the ESP to restart. So ESP will get in to the active loop within few seconds rather than printing the error log in console for more than 10 seconds. But looking for a permanent solution.

@sudheeshsmadhav
Copy link
Author

any solution for this. ?

@VojtechBartoska
Copy link
Contributor

Hello all contributors, can you please retest this on v2.0.3-rc1?

@VojtechBartoska VojtechBartoska added Area: BT&Wifi BT & Wifi related issues Resolution: Awaiting response Waiting for response of author and removed Status: Awaiting triage Issue is waiting for triage labels Apr 11, 2022
@VojtechBartoska
Copy link
Contributor

I'm closing the issue as expired due to no answer.

If needed, please reopen it.

Thanks for understanding.

@VojtechBartoska VojtechBartoska added Resolution: Expired More info wasn't provided and removed Resolution: Awaiting response Waiting for response of author labels May 4, 2022
@maxdd
Copy link

maxdd commented May 27, 2022

I do have a similar issue with chunked data (nothing related with BLE which i dont know what it is mentioned in this issue)

[  4906][D][HTTPClient.cpp:598] sendRequest(): request type: 'GET' redirCount: 0

[  4957][D][HTTPClient.cpp:1156] connect():  connected to www.meteoproject.it:80
[  5047][D][HTTPClient.cpp:1307] handleHeaderResponse(): code: 200
[  5047][D][HTTPClient.cpp:1314] handleHeaderResponse(): Transfer-Encoding: chunked
[  5049][D][HTTPClient.cpp:628] sendRequest(): sendRequest code=200

[  5056][D][HTTPClient.cpp:922] writeToStream():  read chunk len: 16780
[  5159][D][HTTPClient.cpp:1446] writeToStreamDataBlock(): connection closed or file end (written: 16780).
[  5160][D][HTTPClient.cpp:922] writeToStream():  read chunk len: 0
[  5164][D][HTTPClient.cpp:388] disconnect(): still data in buffer (2), clean up.

[  5171][E][WiFiClient.cpp:516] flush(): fail on fd 50, errno: 11, "No more processes"
.[  5181][D][HTTPClient.cpp:393] disconnect(): tcp keep open for reuse

Seems like after the trailing sequence some data is still present in the buffer

char b[2] = {0,0};
_client->readBytes((uint8_t*)b, 2);
Serial.printf("char 1 - %x - ", b[0]);
Serial.printf("char 2 - %x -\n", b[1]);
[  3686][D][HTTPClient.cpp:922] writeToStream():  read chunk len: 16783
[  3773][D][HTTPClient.cpp:1450] writeToStreamDataBlock(): connection closed or file end (written: 16783).
char 1 - 30 - char 2 - d -
[  3784][W][HTTPClient.cpp:1473] returnError(): error(-11): read Timeout
[  3784][D][HTTPClient.cpp:1475] returnError(): tcp stop

Is it a server-side issue?

@ln-12
Copy link

ln-12 commented Jun 13, 2022

Hey @VojtechBartoska, I am using 2.0.3 (stable) and experiencing the same issue.

@VojtechBartoska
Copy link
Contributor

I'm reopening the issue and we will take a look on it.

@VojtechBartoska VojtechBartoska added Status: Needs investigation We need to do some research before taking next steps on this issue and removed Resolution: Expired More info wasn't provided labels Jun 14, 2022
@sudheeshsmadhav
Copy link
Author

sudheeshsmadhav commented Jun 15, 2022

The issue is still existing and I am restarting the esp to overcome this quickly. Looking for a permanent solution.

Using able scan, collection the Bluetooth tag id and their rssi value, publishing it using mqtt.
A ble scan runs in freertos task.

@VojtechBartoska VojtechBartoska removed Resolution: Unable to reproduce With given information issue is unable to reproduce Resolution: Awaiting response Waiting for response of author labels Aug 15, 2023
@PilnyTomas
Copy link
Contributor

Guys, please test PR #8541 and let me know if it works for you. I just hope it doesn't create a new issue :D

@OptifySudarshanPatil
Copy link

Hello @PilnyTomas
Your changes are working as expected. Thanks!
This issue is resolved for me.
Hope this changes will show up into platformio esp32 core.
✌️
image

@VojtechBartoska VojtechBartoska added Status: In Progress Issue is in progress and removed Status: Needs investigation We need to do some research before taking next steps on this issue labels Aug 21, 2023
@VojtechBartoska VojtechBartoska moved this from Todo to In Review in Arduino ESP32 Core Project Roadmap Aug 21, 2023
@PilnyTomas PilnyTomas added Status: Pending Merge Pull Request is ready to be merged and removed Area: BT&Wifi BT & Wifi related issues Status: In Progress Issue is in progress Status: Community help needed Issue need help from any member from the Community. labels Aug 22, 2023
@CelliesProjects
Copy link
Contributor

CelliesProjects commented Aug 29, 2023

@PilnyTomas Works like a charm. Thanks for the effort!

@Oekologisiert
Copy link

I think i found a workraround until all packages are updated with [email protected] in platformio.ini
The problem occures in my case only with [email protected]

@tablatronix
Copy link
Contributor

Same issue, also wifi drops out and fails to reconnect, and debugging of course also stopped logging sigh.
Will isolate version

@VojtechBartoska
Copy link
Contributor

will be fully addressed again in #8699

@arturstopa
Copy link

arturstopa commented Oct 19, 2023

I get the same issuem I'm using WebSockets @ 2.4.1 and WiFi @ 2.0.0
PLATFORM: Espressif 32 (6.4.0) > Espressif ESP32 Dev Module

I'm pretty sure that webSocket.begin() is triggering the error [WiFiClient.cpp:517] flush(): fail on fd 48, errno: 11, "No more processes". CI of WebSockets library is failing, but the error itself is in the WiFi library, so I believe it's worth checking.

@sudheeshsmadhav
Copy link
Author

sudheeshsmadhav commented Feb 23, 2024

Hi, Is this issue is fully addressed? and in which version? I am still getting the same error in e[email protected] - Working with platformio. Also tried this with the following
; platformio/framework-arduinoespressif32@^3.20014.231204
; platform = espressif32

but no luck,
This error hits after 20+ minutes of run.
After sometime ESP32 crashing and restarting.

Please let me know if the fix is released / available in any one branch..
My hardware devices - more than 500 units affected with this.

@VojtechBartoska
@PilnyTomas

@VojtechBartoska
Copy link
Contributor

version 2.0.14 of Arduino core

@bbhxwl
Copy link

bbhxwl commented Jun 4, 2024

I also have the same problem.

@tatulaiot
Copy link

hi guys. any update on this issue? I am having the same trouble here,
thanks a

shb3014 added a commit to Plantsio/arduino-esp32 that referenced this issue Nov 18, 2024
@boazf
Copy link

boazf commented Nov 19, 2024

This also happened to me. I noticed that also sometimes when I attempt to create a new task, the task creation fails. With error "not enough memory". I tried to reduce the size of the stacks of the tasks that I'm creating and it resolved both problems. New tasks are now always get created and this message do not appear anymore. You should of course not reduce the stack size too much so you'll not get stack overflow. Which is another annoying problem.

@bbhxwl
Copy link

bbhxwl commented Nov 20, 2024

How to completely solve this problem at the bottom level, apart from sending a small amount of data?

@boazf
Copy link

boazf commented Nov 21, 2024

How to completely solve this problem at the bottom level, apart from sending a small amount of data?

I think this issue is caused when most of the memory is allocated and the system can't create new objects in order to perform its functions. Try to reduce your memory consumption. Like I did with reducing the size of tasks stack depth. You can check your task stack high watermark using uxTaskGetStackHighWaterMark() and see if you can reduce the stack depth of your tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: WiFi Issue related to WiFi Status: Pending Merge Pull Request is ready to be merged
Projects
Development

No branches or pull requests