Skip to content

Issues When ESP32 WiFi Receives Data #12061

@coconut0213

Description

@coconut0213

Board

eg.ESP32 Dev Module

Device Description

Image

Hardware Configuration

GPIO 0 and 4 are connected to UART2

Version

3.2.0

Type

Question

IDE Name

VSCode

Operating System

Windows 11

Flash frequency

eg.40MHZ

PSRAM enabled

no

Upload speed

eg.115200

Description

When calling the receive function of WIFICLIENT, the read function encountered an error and reported the following error:“assertion "pbuf_free: p->ref > 0" failed: file "/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/pbuf.c", line 766, function: pbuf_free
abort() was called at PC 0x4011dc23 on core 1”,The specific problem occurs in the following code::“_telnetClients[i].read(buf, readlen);”please see the Sketch.

Sketch

if (_telnetClients[i].available()) {
                    uint8_t buf[1024];
                    COMMANDS::wait(0);
                    int readlen  = _telnetClients[i].available();
                    int writelen = TELNETRXBUFFERSIZE - available();
                    if (readlen > 1024) {
   readlen = 1024;
                    }
                    if (readlen > writelen) {
                        readlen = writelen;
                    }
                    if (readlen > 0) {

                        _telnetClients[i].read(buf, readlen);
                        push(buf, readlen);
                    }
                    
                    return;
                }
} else {
                if (_telnetClients[i]) {
#    ifdef ENABLE_TELNET_WELCOME_MSG
                    _telnetClientsIP[i] = IPAddress(0, 0, 0, 0);
#    endif
                    _telnetClients[i].stop();
                }
            }
            COMMANDS::wait(0);
        }

Debug Message

assertion "pbuf_free: p->ref > 0" failed: file "/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/pbuf.c", line 766, function: pbuf_free
abort() was called at PC 0x4011dc23 on core 1

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions