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

Release 1.9 breakes previously running code #39

Closed
ghost opened this issue Sep 21, 2022 · 3 comments
Closed

Release 1.9 breakes previously running code #39

ghost opened this issue Sep 21, 2022 · 3 comments
Labels
invalid This doesn't seem right Support Library support

Comments

@ghost
Copy link

ghost commented Sep 21, 2022

On ESP8266:

After updating from 1.8.2 to 1.9.1 my code shows some unexpected behaviour:
The code compilies and runs without crashing but some sequencing seems to be messed up. The request callback seems to be called before sending and the readyState is set to readyStateDone incorrecty. Later the request callback is called again with the actual http request, which seems to have worked annyway. I am guessing the readyState is set incorrecty to readyStateDone somewhere early in the toolchain, which seems to trigger unexpected behaviour.

@khoih-prog
Copy link
Owner

Hi @ValentinsStorre

Thanks for using the library.

It's very normal that anyone's code needs to be rechecked or modified a little bit, if necessary, after updating any library. That's why a new version is created, with added features, functions, etc.

Moreover, as you're using ESP8266, you can use asyncHTTPrequest library, if better for you.

Good Luck


I retest using ESP8266, and see nothing abnormal here

Starting AsyncHTTPRequest_ESP using ESP8266_NODEMCU_ESP12E
AsyncHTTPRequest_Generic v1.9.1
Connecting to WiFi SSID: HueNet1
...........
AsyncHTTPRequest @ IP : 192.168.2.111


**************************************
abbreviation: EDT
client_ip: 69.165.147.15
datetime: 2022-09-22T13:03:40.077232-04:00
day_of_week: 4
day_of_year: 265
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1663866220
utc_datetime: 2022-09-22T17:03:40.077232+00:00
utc_offset: -04:00
week_number: 38
**************************************
HHHHHH
**************************************
abbreviation: EDT
client_ip: 69.165.147.15
datetime: 2022-09-22T13:04:40.050140-04:00
day_of_week: 4
day_of_year: 265
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1663866280
utc_datetime: 2022-09-22T17:04:40.050140+00:00
utc_offset: -04:00
week_number: 38
**************************************
HHHH HH
**************************************
abbreviation: EDT
client_ip: 69.165.147.15
datetime: 2022-09-22T13:05:40.050118-04:00
day_of_week: 4
day_of_year: 265
dst: true
dst_from: 2022-03-13T07:00:00+00:00
dst_offset: 3600
dst_until: 2022-11-06T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1663866340
utc_datetime: 2022-09-22T17:05:40.050118+00:00
utc_offset: -04:00
week_number: 38
**************************************

@khoih-prog khoih-prog added invalid This doesn't seem right Support Library support labels Sep 22, 2022
@ghost
Copy link
Author

ghost commented Sep 22, 2022

I am sorry, I was a bit lazy and had not attached any debug log. I thought the problem was somewhat obvious.

Version 1.8.2.

23:18:43.125 -> Sending async. HTTP GET-Request token-get to Blynk API: http://fra1.blynk.cloud/external/api/get?token=***&v13&v14&v24&v16&v22&v25
23:18:43.125 -> [AHTTP] open( GET , url = http://fra1.blynk.cloud/external/api/get?token=***&v13&v14&v24&v16&v22&v25
23:18:43.125 -> [AHTTP] _parseURL(): scheme+host HTTP:// fra1.blynk.cloud
23:18:43.125 -> [AHTTP] _parseURL(): port+path+query 80 /external/api/get ?token=***&v13&v14&v24&v16&v22&v25
23:18:43.125 -> [AHTTP] open: conneting to hostname = fra1.blynk.cloud:80
23:18:43.125 -> [AHTTP] _connect()
23:18:43.125 -> GET request send. readyState = 0
23:18:43.125 -> [AHTTP] send()
23:18:43.125 -> [AHTTP] _buildRequest()
23:18:43.125 -> [AHTTP] _HTTPmethod = 0
23:18:43.125 -> [AHTTP] GET  /external/api/get ?token=***&v13&v14&v24&v16&v22&v25  HTTP/1.1
23:18:43.125 -> 
23:18:43.125 -> [AHTTP] host : fra1.blynk.cloud:80 
23:18:43.125 -> 
23:18:43.125 -> [AHTTP] _send(), _request->available = 123
23:18:43.125 -> [AHTTP] !connected
23:18:43.125 -> [AHTTP] _onConnect handler
23:18:43.125 -> [AHTTP] _setReadyState : 1
23:18:43.163 -> [AHTTP] _send(), _request->available = 123
23:18:43.163 -> [AHTTP] *send 123
23:18:43.202 -> [AHTTP] _onData handler HTTP/1.1 200 OK
23:18:43.202 -> connection: keep-alive
23:18:43.202 -> content-type: application/json;charset=utf-8
23:18:43.202 -> access-control-allow-origin: *
23:18:43.202 -> content-length: 50
23:18:43.202 -> 
23:18:43.202 -> {"v13":1,"v14":54,"v24":0,"v16":1,"v22":0,"v25":0}st:fra18���/���loud:80
23:18:43.202 -> 
23:18:43.202 -> �����P�5��� , len = 191
23:18:43.202 -> [AHTTP] _collectHeaders()
23:18:43.202 -> [AHTTP] xbuf::readString: Reserved size =  18
23:18:43.202 -> [AHTTP] xbuf::readString: Reserved size =  25
23:18:43.202 -> [AHTTP] xbuf::readString: Reserved size =  47
23:18:43.202 -> [AHTTP] xbuf::readString: Reserved size =  33
23:18:43.202 -> [AHTTP] xbuf::readString: Reserved size =  21
23:18:43.202 -> [AHTTP] xbuf::readString: Reserved size =  3
23:18:43.202 -> [AHTTP] _setReadyState : 2
23:18:43.202 -> [AHTTP] _setReadyState : 3
23:18:43.202 -> [AHTTP] *all data received - no disconnect
23:18:43.202 -> [AHTTP] _setReadyState : 4
23:18:43.202 -> Settings async. http GET get-request DONE after 65ms!
23:18:43.202 -> HTTP response code: 200
23:18:43.202 -> [AHTTP] responseText()
23:18:43.202 -> [AHTTP] xbuf::readString: Reserved size =  51
23:18:43.202 -> [AHTTP] responseText(char) {"v13":1,"v14":54,"v24":0,"v16":1,"v22":0,"v25":0} , avail = 50
23:18:43.202 -> Response: {"v13":1,"v14":54,"v24":0,"v16":1,"v22":0,"v25":0}

Version 1.9.1.

23:47:05.857 -> Sending async. HTTP GET-Request token-get to Blynk API: http://fra1.blynk.cloud/external/api/get?token=***&v14&v24&v16&v22&v25
23:47:05.857 -> [AHTTP] open( GET , url = http://fra1.blynk.cloud/external/api/get?token=***&v13&v14&v24&v16&v22&v25
23:47:05.857 -> [AHTTP] _parseURL(): scheme+host HTTP:// fra1.blynk.cloud
23:47:05.857 -> [AHTTP] _parseURL(): port+path+query 80 /external/api/get ?token=***&v13&v14&v24&v16&v22&v25
23:47:05.857 -> [AHTTP] open: connecting to hostname = fra1.blynk.cloud:80
23:47:05.857 -> [AHTTP] _connect()
23:47:05.857 -> [AHTTP] _client->connecting to fra1.blynk.cloud , 80
23:47:05.857 -> [AHTTP] client.connect OK to fra1.blynk.cloud , 80
23:47:05.857 -> [AHTTP] _connect() true
23:47:05.857 -> GET request send. readyState = 0
23:47:05.857 -> [AHTTP] send()
23:47:05.857 -> [AHTTP] _buildRequest()
23:47:05.857 -> [AHTTP] _HTTPmethod = 0
23:47:05.857 -> [AHTTP] GET  /external/api/get ?token=***&v13&v14&v24&v16&v22&v25 HTTP/1.1
23:47:05.857 -> 
23:47:05.857 -> [AHTTP] host : fra1.blynk.cloud:80 
23:47:05.857 -> 
23:47:05.857 -> [AHTTP] _send(), _request->available = 123
23:47:05.857 -> [AHTTP] !connected yet
23:47:05.857 -> [AHTTP] _setReadyState : 4
23:47:05.857 -> Settings async. http GET get-request DONE after 4294965212ms!
23:47:05.857 -> HTTP response code: -4
23:47:05.897 -> [AHTTP] _onConnect handler
23:47:05.897 -> [AHTTP] _setReadyState : 1
23:47:05.897 -> [AHTTP] _send(), _request->available = 123
23:47:05.897 -> [AHTTP] *send 123
23:47:05.934 -> [AHTTP] _onData handler HTTP/1.1 200 OK
23:47:05.934 -> connection: keep-alive
23:47:05.934 -> content-type: application/json;charset=utf-8
23:47:05.934 -> access-control-allow-origin: *
23:47:05.934 -> content-length: 50
23:47:05.934 -> 
23:47:05.934 -> {"v13":1,"v14":54,"v24":0,"v16":1,"v22":0,"v25":0}st:fra18���3�w�loud:80
23:47:05.934 -> 
23:47:05.934 -> �����P�5��� , len = 191
23:47:05.934 -> [AHTTP] _collectHeaders()
23:47:05.934 -> [AHTTP] _setReadyState : 2
23:47:05.934 -> [AHTTP] _setReadyState : 3
23:47:05.934 -> [AHTTP] *all data received - no disconnect
23:47:05.934 -> [AHTTP] _setReadyState : 4
23:47:05.934 -> Settings async. http GET get-request DONE after 61ms!
23:47:05.934 -> HTTP response code: 200
23:47:05.934 -> [AHTTP] responseText()
23:47:05.934 -> [AHTTP] responseText() = {"v13":1,"v14":5 , size = 50
23:47:05.934 -> Response: {"v13":1,"v14":54,"v24":0,"v16":1,"v22":0,"v25":0}

As I already said: It seems like the readyState is set incorrecty to readyStateDone early in the toolchain.

23:47:05.857 -> [AHTTP] !connected yet
23:47:05.857 -> [AHTTP] _setReadyState : 4   <-

This is not a problem of backward compatibility with my code. The library has obviously some kind of glitch, which can't be intended. There is nothing I can fix on my side, to change that issue without messing with the library source code.

@ghost ghost changed the title Realese 1.9 breakes previously running code Release 1.9 breakes previously running code Sep 22, 2022
khoih-prog added a commit that referenced this issue Oct 21, 2022
### Releases v1.10.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](#39) and [Callback behaviour is buggy (ESP8266) #43](#43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
@khoih-prog
Copy link
Owner

Hi @ValentinsStorre

Please try the new AsyncHTTPRequest_Generic v1.10.1. Your contribution is noted in Contributions and Thanks


Releases v1.10.1

  1. Fix bug of wrong reqStates. Check Release 1.9 breakes previously running code #39 and Callback behaviour is buggy (ESP8266) #43
  2. Optional larger DEFAULT_RX_TIMEOUT from default 3s, for slower networks

khoih-prog added a commit to khoih-prog/AsyncHTTPRequest_RP2040W that referenced this issue Oct 21, 2022
### Release v1.2.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
khoih-prog added a commit to khoih-prog/AsyncHTTPRequest_RP2040W that referenced this issue Oct 21, 2022
### Release v1.2.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
khoih-prog added a commit to khoih-prog/AsyncHTTPRequest_RP2040W that referenced this issue Oct 21, 2022
### Release v1.2.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
khoih-prog added a commit to khoih-prog/Portenta_H7_AsyncHTTPRequest that referenced this issue Oct 21, 2022
### Releases v1.4.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
khoih-prog added a commit to khoih-prog/Portenta_H7_AsyncHTTPRequest that referenced this issue Oct 21, 2022
### Releases v1.4.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
khoih-prog added a commit to khoih-prog/AsyncHTTPRequest_Teensy41 that referenced this issue Oct 21, 2022
### Release v1.9.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43)
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
khoih-prog added a commit to khoih-prog/AsyncHTTPRequest_Teensy41 that referenced this issue Oct 21, 2022
### Release v1.9.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43).
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
khoih-prog added a commit to khoih-prog/AsyncHTTPRequest_Teensy41 that referenced this issue Oct 21, 2022
### Release v1.9.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43).
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
khoih-prog added a commit to khoih-prog/AsyncHTTPRequest_Teensy41 that referenced this issue Oct 21, 2022
### Release v1.9.1

1. Fix bug of wrong `reqStates`. Check [Release 1.9 breakes previously running code #39](khoih-prog/AsyncHTTPRequest_Generic#39) and [Callback behaviour is buggy (ESP8266) #43](khoih-prog/AsyncHTTPRequest_Generic#43).
2. Optional larger `DEFAULT_RX_TIMEOUT` from default 3s, for slower networks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right Support Library support
Projects
None yet
Development

No branches or pull requests

1 participant