B4R Question [SOLVED] Error in rHttpUtils HTTPJob.Download after StartAccessPoint

hatzisn

Well-Known Member
Licensed User
Good evening everyone,

I am facing a problem. Here is the situation. There is an ESP8266 application which has an ESP8266 configurator module that the first time or every time that it tries to connect with a different router it creates an AccessPoint. With this access point activated it initializes a WiFiServerSocket and waits for connection. With this server socket it receives the connection details from a mobile. This information is saved in the eeprom of the board. When it is saved it tries to connect with the given info in the SSID (with SSIDName & Password) and it connects successfully. So far so good. When it connects to the WiFi it tries to connect to my site to get a new JSON with an id of the record and a created code from my site in order for it to save it also in eeprom so it can be identified later by the back end.

The problem is there is not a fixed problem everytime but the errors loop arbitrarily.

These are the errors I get in each trial:

1) Failed to connect - Status 0
2) Unidentified C++ exception - OOM
3) Soft WDT Reset
4) Exception (29)

Here are the logs:

SSID-00001-jsdfhjsdfhjs
Free Ram: 26104
In sub UnableToConnectToWiFi
In sub RetryingToConnectToWiFi
SSID-00001-jsdfhjsdfhjs
Free Ram: 26104
In sub UnableToConnectToWiFi
close connection
Initiating Access Point
In sub SuccessfullyCreatedAP
Initialized server listening in 5555
My IP is: 192.168.4.1
Successfully created access point
Free Ram: 23992
Server New Connection
{"ssid":"SSID-00001","pass":"jsdfhjsdfhjs","lat":"37.847054","long":"23.785939","usr":"hatzisn","usps":"
--
123691"}
--
Received JSON
Storing in GlobalStore
Responding to the sender with <ok>
Length:108
SSID-00001-jsdfhjsdfhjs
Free Ram: 23720
In sub UnableToConnectToWiFi
In sub RetryingToConnectToWiFi
SSID-00001-jsdfhjsdfhjs
Free Ram: 23720
In sub UnableToConnectToWiFi
In sub RetryingToConnectToWiFi
SSID-00001-jsdfhjsdfhjs
Free Ram: 23720
In sub UnableToConnectToWiFi
close connection
Initiating Access Point
In sub SuccessfullyCreatedAP
Initialized server listening in 5555
My IP is: 192.168.4.1
Successfully created access point
Free Ram: 23768
Disconnected
Server New Connection
{"ssid":"SSID-00001","pass":"jsdfhjsdfhjs","lat":"37.947054","long":"23.665939","usr":"hatzisn","usps":"
--
123458"}
--
Received JSON
Storing in GlobalStore
Responding to the sender with <ok>
Length:108
SSID-00001-jsdfhjsdfhjs
Free Ram: 23576
close connection
Connected to wifi: 1
Writting connection data received to eeprom.
Writting data available flag
Registering and Getting IOT ID
Reading byte 1 if there is saved IOT_ID Json
Have read byte 1
Checking if there is JSON Length in byte(1)
26
CHK:12
CHK:13
CHK:14
CHK:15
CHK:16
Free Ram: 23064
trying to connect to: tools.mysite.com port: 443 ssl: 1

User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Unhandled C++ exception: OOM

>>>stack>>>

ctx: cont
sp: 3ffff950 end: 3fffffc0 offset: 0000
3ffff950: 40258cee 3fff2634 3fff2302 00000000
3ffff960: 000000fe 00000000 00000000 00000000
3ffff970: 00000000 00000000 00000000 00000001
3ffff980: 00007fff 00000000 c030c02c 00000000
3ffff990: 00000000 4020a7a3 000005d8 4020db62
3ffff9a0: 00000000 4020a7a3 00000020 4020db81
3ffff9b0: c02ac026 c00ec004 000005d8 4020d178
3ffff9c0: c09dc09c 00000001 3fff2af4 4020a7a3
3ffff9d0: 00000000 c00dc003 3fff000a 4020a410
3ffff9e0: 00000000 00000000 00000d60 3fff4678
3ffff9f0: 00000000 3fff6bf4 3fff2af4 4020ac4d
3ffffa00: 00000043 3fff1f80 00000001 4020d310
3ffffa10: 00000000 00000000 000001bb 4020dc8a
3ffffa20: 00000000 3fff59bc 3fff2af4 40209c32
3ffffa30: 3fff6694 00000000 3fff4678 000001f4
3ffffa40: 000001bb 3fff4678 3fff2af4 000001f4
3ffffa50: 000001bb 3fff4678 3fff2af4 4020add9
3ffffa60: 40210464 d895f388 40210464 d895f388
3ffffa70: 3fff1c04 00000000 3fff4670 4020f69e
3ffffa80: 3fff4678 00000066 3fff0420 4020f450
3ffffa90: 3ffffa98 00000000 3fff4670 40208298
3ffffaa0: 3fff1c22 00000000 3fff4670 40203e19
3ffffab0: 4025e868 00000003 000001bb 00000066
3ffffac0: 4025e860 00000008 00000001 4020e500
3ffffad0: 00000000 3fff0000 00000000 4020b700
3ffffae0: 00000000 00000000 00000000 3fff4500
3ffffaf0: 00000000 00000100 00000000 4020d300
3ffffb00: 000001ec 00000000 00000013 3fff4680
3ffffb10: 0000013c 000001ec 3ffeec9c 3fff45b0
3ffffb20: 3fff0630 000001ec 3ffeec9c 402045a9
3ffffb30: 3ffe8959 00000101 3ffeec9c 40201ac2
3ffffb40: 00000001 3fff45d0 3fff45f0 4020301a
3ffffb50: 3ffffcf8 3fff45c0 3ffffcf0 3fff45d0
3ffffb60: 3ffffce8 3fff45e0 3fff5894 4010018c
3ffffb70: 34333231 40103835 3ffed7e0 40101fa0
3ffffb80: 4010486b 40105237 3ffed050 40102d08
3ffffb90: 40102b2b 3ffed050 00000000 4010018c
3ffffba0: 40104333 0000007f 00000000 00040000
3ffffbb0: 00000000 00000000 00000000 00000001
3ffffbc0: 401031fc 00080000 401031c2 00000100
3ffffbd0: 3ffe9ee0 00000000 00000000 00000001
3ffffbe0: 00000001 2c9f0300 4000050c 3fffc278
3ffffbf0: 40102ee4 3fffc200 00000022 0b9eb30e
3ffffc00: 4020ec5b 00000030 0000001e ffffffff
3ffffc10: 7a746168 006e7369 0000001f 4010018c
3ffffc20: 00000000 00000000 3fffc228 40105ad1
3ffffc30: 4000050c 00000000 0000001f 4010018c
3ffffc40: 4020d307 00000030 00000008 3ffffd00
3ffffc50: 3fff45b0 3ffffcf8 3fff45c0 3ffffcf0
3ffffc60: 3fff45d0 3ffffce8 3fff45e0 fffffffe
3ffffc70: ffffffff 3ff
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Unhandled C++ exception: OOM

>>>stack>>>

ctx: cont
sp: 3ffff680 end: 3fffffc0 offset: 0000
3ffff680: 4025ebd9 00000000 3ffff6e0 40212780
3ffff690: 000000fe 00000000 00000000 00000000
3ffff6a0: 00000000 00000000 00000000 40216900
3ffff6b0: 00000000 4025ebd9 00000001 00002200
3ffff6c0: 3fffc200 40102ee4 04000000 401018be
3ffff6d0: 00000003 00000004 40003b53 00000000
3ffff6e0: 00000000 00000000 00000000 40102eca
3ffff6f0: 40102f41 00000031 40302063 00000000
3ffff700: 00000000 00000000 00000000 00000004
3ffff710: 40003b4d 2c9f0300 4000050c 3fffc278
3ffff720: 40102ee4 3fffc200 00000022 40216900
3ffff730: 40003b53 00000030 00000010 ffffffff
3ffff740: 40001ddc 00000066 00018000 00000000
3ffff750: 00ff0000 5ffffe00 5ffffe00 00000000
3ffff760: 00018000 00000000 3ffff723 3ffff858
3ffff770: 00000020 0000003c 3fffffc0 00000030
3ffff780: 0000003c 3ffe8368 000000a0 40214091
3ffff790: 3ffff871 00000000 0000006e ffff0208
3ffff7a0: 3ffff840 0000009f 3fffefc0 00000030
3ffff7b0: 3fffffc0 3ffe8368 000000a0 40214091
3ffff7c0: 3ffff898 00000000 00000077 ffff0208
3ffff7d0: 3ffff870 0000009f 401031c2 00000100
3ffff7e0: 3ffe9f04 7fffffff 00002200 00000001
3ffff7f0: 00000001 00000080 00000000 00000030
3ffff800: 3ffe9f04 00000020 3ffff840 402140cd
3ffff810: 3ffff900 3ffff8f0 00000004 3fffc278
3ffff820: 40102ee4 3fffc200 00000022 402140cd
3ffff830: 4020d845 3ffff950 3ffff870 4020d838
3ffff840: 66666633 30376366 6620203a 66666666
3ffff850: 20666666 66666633 63663663 30303020
3ffff860: 30303030 30302031 30303030 20203030
3ffff870: 203a000a 66666633 30353966 646e6520
3ffff880: 6633203a 66666666 6f203063 65736666
3ffff890: 30203a74 0a303030 00000000 3ffff9d0
3ffff8a0: 00000099 3fffc6fc 0000005c 3fff6c04
3ffff8b0: 4020d845 0000002d 3ffff9e0 4020d838
3ffff8c0: 6573550a 78652072 74706563 206e6f69
3ffff8d0: 6e617028 612f6369 74726f62 7373612f
3ffff8e0: 3ffff900 3ffff8f0 00000004 4021a348
3ffff8f0: 3fff2224 3ffffc70 ffffffff 3fffc6fc
3ffff900: 00000001 00000000 00000004 4021d8cc
3ffff910: 3ffff930 3ffff920 3ffffc80 4020d892
3ffff920: 00000020 3ffff950 3fffffc0 00000000
3ffff930: 5ffffe00 5ffffe00 0000000f 3fffefc0
3ffff940: 3fffffc0 3ffff950 3ffff950 4020daf2 <
3ffff950: 40258cee 3fff2634 3fff2302 00000000
3ffff960: 000000fe 00000000 00000000 00000000
3ffff970: 00000000 00000000 00000000 00000001
3ffff980: 00007fff 00000000 c030c02c 00000000
3ffff990: 00000000 4020a7a3 000005d8 4020db62
3ffff9a0: 00000000 4020a7a3 00000020 4020db81
3ffff9b0: c02ac026 c00ec004 000005d8 4020d178
3ffff9c0: c09dc09c 00000001 3fff2af4 4020a7a3
3ffff9d0: 00000000 c00dc003 3fff000a 4020a410
3ffff9e0: 00000000 00000000 00000d60 3fff4678
3ffff9f0: 00000000 3fff6bf4 3fff2af4 4020ac4d
3ffffa00: 00000043 3fff1f80 00000001 4020d310
3ffffa10: 00000000 00000000 000001bb 4020dc8a
3ffffa20: 00000000 3fff59bc 3fff2af4 40209c32
3ffffa30: 3fff6694 00000000 3fff4678 000001f4
3ffffa40: 000001bb 3fff4678 3fff2af4 000001f4
3ffffa50: 000001bb 3fff4678 3fff2af4 4020add9
3ffffa60: 40210464 d895f388 40210464 d895f388
3ffffa70: 3fff1c04 00000000 3fff4670 4020f69e
3ffffa80: 3fff4678 00000066 3fff0420 4020f450
3ffffa90: 3ffffa98 00000000 3fff4670 40208298
3ffffaa0: 3fff1c22 00000000 3fff4670 40203e19
3ffffab0: 4025e868 00000003 000001bb 00000066
3ffffac0: 4025e860 00000008 00000001 4020e500
3ffffad0: 00000000 3fff0000 00000000 4020b700
3ffffae0: 00000000 00000000 00000000 3fff4500
3ffffaf0: 00000000 00000100 00000000 4020d300
3ffffb00: 000001ec 00000000 00000013 3fff4680
3ffffb10: 0000013c 000001ec 3ffeec9c 3fff45b0
3ffffb20: 3fff0630 000001ec 3ffeec9c 402045a9
3ffffb30: 3ffe8959 00000101 3ffeec9c 40201ac2
3ffffb40: 00000001 3fff45d0 3fff45f0 4020301a
3ffffb50: 3ffffcf8 3fff45c0 3ffffcf0 3fff45d0
3ffffb60: 3ffffce8 3fff45e0 3fff5894 4010018c
3ffffb70: 34333231 40103835 3ffed7e0 40101fa0
3ffffb80: 4010486b 40105237 3ffed050 40102d08
3ffffb90: 40102b2b 3ffed050 00000000 4010018c
3ffffba0: 40104333 0000007f 00000000 00040000
3ffffbb0: 00000000 00000000 00000000 00000001
3ffffbc0: 401031fc 00080000 401031c2 00000100
3ffffbd0: 3ffe9ee0 00000000 00000000 00000001
3ffffbe0: 00000001 2c9f0300 4000050c 3fffc278
3ffffbf0: 40102ee4 3fffc200 00000022 0b9eb30e
3ffffc00: 4020ec5b 00000030 0000001e ffffffff
3ffffc10: 7a746168 006e7369 0000001f 4010018c
3ffffc20: 00000000 00000000 3fffc228 40105ad1
3ffffc30: 4000050c 00000000 0000001f 4010018c
3ffffc40: 4020d307 00000030 00000008 3ffffd00
3ffffc50: 3fff45b0 3ffffcf8 3fff45c0 3ffffcf0
3ffffc60: 3fff45d0 3ffffce8 3fff45e0 fffffffe
3ffffc70: ffffffff 3fffc6fc 00000001 00000000

The ESP exception decoder of the above error gives the following:

Decoding stack results
0x40212780: _printf_i at /workdir/repo/newlib/newlib/libc/stdio/nano-vfprintf_i.c line 246
0x40216900: __ssputs_r at /workdir/repo/newlib/newlib/libc/stdio/nano-vfprintf.c line 232
0x40216900: __ssputs_r at /workdir/repo/newlib/newlib/libc/stdio/nano-vfprintf.c line 232
0x40214091: _vsnprintf_r at /workdir/repo/newlib/newlib/libc/stdio/vsnprintf.c line 71
0x40214091: _vsnprintf_r at /workdir/repo/newlib/newlib/libc/stdio/vsnprintf.c line 71
0x402140cd: vsnprintf at /workdir/repo/newlib/newlib/libc/stdio/vsnprintf.c line 40
0x402140cd: vsnprintf at /workdir/repo/newlib/newlib/libc/stdio/vsnprintf.c line 40
0x4020d845: ets_printf_P(char const*, ...) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_postmortem.cpp line 94
0x4020d838: ets_printf_P(char const*, ...) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_postmortem.cpp line 93
0x4020d845: ets_printf_P(char const*, ...) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_postmortem.cpp line 94
0x4020d838: ets_printf_P(char const*, ...) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_postmortem.cpp line 93
0x4021a348: udp_sendto_if_src at core/udp.c line 893
0x4021d8cc: etharp_output_LWIP2 at core/ipv4/etharp.c line 885
0x4020d892: print_stack(uint32_t, uint32_t) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_postmortem.cpp line 237
0x4020daf2: __wrap_system_restart_local() at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_postmortem.cpp line 208
0x4020a7a3: BearSSL::WiFiClientSecureCtx::_installClientX509Validator() at c:\users\nikos\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\ext/new_allocator.h line 103
0x4020a7a3: BearSSL::WiFiClientSecureCtx::_installClientX509Validator() at c:\users\nikos\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\ext/new_allocator.h line 103
0x4020d178: operator new(unsigned int) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\abi.cpp line 44
0x4020a7a3: BearSSL::WiFiClientSecureCtx::_installClientX509Validator() at c:\users\nikos\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\ext/new_allocator.h line 103
0x4020a410: std::__shared_ptr::eek:perator=(std::__shared_ptr&&) at c:\users\nikos\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/shared_ptr_base.h line 1183
0x4020ac4d: BearSSL::WiFiClientSecureCtx::_connectSSL(char const*) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src\WiFiClientSecureBearSSL.cpp line 1134
0x4020d310: __esp_yield() at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 116
0x4020dc8a: __delay(unsigned long) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_wiring.cpp line 54
0x40209c32: WiFiClient::connect(IPAddress, unsigned short) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/include/ClientContext.h line 148
0x4020add9: BearSSL::WiFiClientSecureCtx::connect(char const*, unsigned short) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src\WiFiClientSecureBearSSL.cpp line 231
0x4020f69e: BearSSL::WiFiClientSecure::connect(char const*, unsigned short) at c:\users\nikos\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\c++\10.3.0\bits/shared_ptr_base.h line 1324
0x4020f450: B4R::BufferedWiFiClient::connect(char const*, unsigned short) at C:\B4X\MyCode\B4R\MyCode\DHQICalendar\Objects\src/BufferedWiFiClient.cpp line 7
0x40208298: B4R::WiFiSSLSocket::ConnectHost(B4R::B4RString*, unsigned short) at C:\B4X\MyCode\B4R\MyCode\DHQICalendar\Objects\src/rESP8266WiFi.cpp line 111
0x40203e19: b4r_httpjob::_sendrequest(unsigned char) at C:\B4X\MyCode\B4R\MyCode\DHQICalendar\Objects\src/b4r_httpjob.cpp line 372
0x4020e500: uart_write(uart_t*, char const*, size_t) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\uart.cpp line 546
0x4020b700: EspClass::flashWrite(unsigned int, unsigned int const*, unsigned int) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\Esp.cpp line 707
0x4020d300: __esp_yield() at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 121
0x402045a9: b4r_httpjob::_download(B4R::Array*) at C:\B4X\MyCode\B4R\MyCode\DHQICalendar\Objects\src/b4r_httpjob.cpp line 111
0x40201ac2: B4R::B4RString::GetBytes() at C:\B4X\MyCode\B4R\MyCode\DHQICalendar\Objects\src/B4RCore.cpp line 337
0x4020301a: b4r_espconf::_connectwifi(unsigned char, B4R::Array*, B4R::Array*, B4R::B4RString*, B4R::Array*) at C:\B4X\MyCode\B4R\MyCode\DHQICalendar\Objects\src/b4r_espconf.cpp line 276
0x4010018c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 181
0x4010018c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 181
0x4020ec5b: run_scheduled_recurrent_functions() at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\Schedule.cpp line 250
0x4010018c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 181
0x4010018c: ets_post(uint8, ETSSignal, ETSParam) at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 181
0x4020d307: __esp_yield() at C:\Users\Nikos\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/core_esp8266_features.h line 66


Any suggestions anyone?
 
Last edited:

hatzisn

Well-Known Member
Licensed User
It's been solved. I divided the procedure in three sub-procedures which are executed according to a byte (with value 1,2 or 3) read from EEPROM. Thus less memory is used and it works (this stage at least).
 
Upvote 0
Top