Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Http GET polling causes crash when host disconnected #22

Closed
@andrewk123

Description

@andrewk123

A follow up to a previous issue since I am seeing the same issue.

Bug report is as follows:

Describe the bug

Multiple requests to an internal NodeJS server when the server is disconnected causes a crash.

Steps to Reproduce

Use the example "AsyncHTTPRequest_ESP.ino"

Only changes in this sketch are as follows:
Line 49 #define ASYNC_HTTP_LOGLEVEL 4
Line 52 #define HTTP_REQUEST_INTERVAL 10
Line 59 and 60 add SSID and Password
Line 102 change to requestOpenResult = request.open("GET", "http://192.168.59.188/ping.htm");

Expected behavior

When the target is disconnected an HTTP error code should be returned after a very short timeout (ideally controlled by setTimeout() or the like).

Actual behavior

When http://192.168.59.188/ping.htm is available everything works as expected (the ping page just generates an OK) which is printed by the Sketch. However if you connect the ethernet cable, requests receive no response (as expected). However, after several requests (typically 3) the ESP restarts,

Please ensure to specify the following:

  • Arduino IDE version (e.g. 1.8.13) or Platform.io version
    Arduino IDE 1.8.13
  • ESP8266,ESP32 or STM32 Core Version (e.g. ESP8266 core v2.7.4, ESP32 v1.0.5 or STM32 v1.9.0)
    ESP8266 Core 3.0.2

Here is the debug output:

AsyncHTTPRequest @ IP : 192.168.1.23
[AHTTP] open( GET , url = http://192.168.1.21/ping.htm
[AHTTP] _parseURL(): scheme+host HTTP:// 192.168.1.21
[AHTTP] _parseURL(): port+path+query 80 /ping.htm
[AHTTP] open: conneting to hostname = 192.168.1.21:80
[AHTTP] _connect()
[AHTTP] send()
[AHTTP] _buildRequest()
[AHTTP] _HTTPmethod = 0
[AHTTP] GET /ping.htm HTTP/1.1

[AHTTP] host : 192.168.1.21:80

[AHTTP] _send(), _request->available = 50
[AHTTP] *can't send
[AHTTP] open( GET , url = http://192.168.1.21/ping.htm
[AHTTP] _parseURL(): scheme+host HTTP:// 192.168.1.21
[AHTTP] _parseURL(): port+path+query 80 /ping.htm
[AHTTP] open: conneting to hostname = 192.168.1.21:80
[AHTTP] _connect()
[AHTTP] send()
[AHTTP] _buildRequest()
[AHTTP] _HTTPmethod = 0
[AHTTP] GET /ping.htm HTTP/1.1

[AHTTP] host : 192.168.1.21:80

[AHTTP] _send(), _request->available = 50
[AHTTP] *can't send
H[AHTTP] open( GET , url = http://192.168.1.21/ping.htm
[AHTTP] _parseURL(): scheme+host HTTP:// 192.168.1.21
[AHTTP] _parseURL(): port+path+query 80 /ping.htm
[AHTTP] open: conneting to hostname = 192.168.1.21:80
[AHTTP] _connect()
[AHTTP] send()
[AHTTP] _buildRequest()
[AHTTP] _HTTPmethod = 0
[AHTTP] GET /ping.htm HTTP/1.1

[AHTTP] host : 192.168.1.21:80

[AHTTP] _send(), _request->available = 50
[AHTTP] *can't send
H[AHTTP] open( GET , url = http://192.168.1.21/ping.htm
[AHTTP] _parseURL(): scheme+host HTTP:// 192.168.1.21
[AHTTP] _parseURL(): port+path+query 80 /ping.htm
[AHTTP] open: conneting to hostname = 192.168.1.21:80
[AHTTP] _connect()
[AHTTP] send()
[AHTTP] _buildRequest()
[AHTTP] _HTTPmethod = 0
[AHTTP] GET /ping.htm HTTP/1.1

[AHTTP] host : 192.168.1.21:80

[AHTTP] _send(), _request->available = 50
[AHTTP] *can't send
H[AHTTP] _onError handler error = -13
[AHTTP]
_onDisconnect handler
[AHTTP] _setReadyState : 4


[AHTTP] responseText()
[AHTTP] responseText() no data


--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Note: It takes approximately 30 seconds from the first [AHTTP] *can't send till the _onDisconnect handler fires. The reset happens at the time the next request would happen after the _onDisconnect handler fires.

Thanks for your help

Originally posted by @andrewk123 in #16 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions