Skip to content

Bug: esp32 nodemcu HTTP requests throwing InstrFetchProhibited #192

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

Closed
xtrinch opened this issue Apr 26, 2020 · 4 comments
Closed

Bug: esp32 nodemcu HTTP requests throwing InstrFetchProhibited #192

xtrinch opened this issue Apr 26, 2020 · 4 comments
Assignees

Comments

@xtrinch
Copy link

xtrinch commented Apr 26, 2020

I am using esp32 nodemcu with arduino framework building with platformIO.
Here's my platformio.ini:

[env:nodemcu-32s]
platform = espressif32
board = nodemcu-32s
framework = arduino
lib_deps = 
	bcl@^0.0.5
	ArduinoJson@^6.15.1
	micro-ecc@^1.0.0
	BIP66@^0.3.2
	Ark-Cpp-Crypto@^1.1.0
	Ark-Cpp-Client@^1.4.1

HTTP requests are randomly throwing the following error (Sometimes they work once, sometimes twice, and then force the controller to reboot):

Guru Meditation Error: Core  1 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x00000000  PS      : 0x00060830  A0      : 0x801361d7  A1      : 0x3ffb1d50  
A2      : 0x3ffb1e90  A3      : 0x00000000  A4      : 0x3ffd62a4  A5      : 0x0000004b  
A6      : 0x3ffd6304  A7      : 0x0000004b  A8      : 0x80162562  A9      : 0x3ffb1d30  
A10     : 0x3ffcbe1c  A11     : 0x00000000  A12     : 0x0000004b  A13     : 0x00000000  
A14     : 0xffffffff  A15     : 0x00000004  SAR     : 0x0000000a  EXCCAUSE: 0x00000014  
EXCVADDR: 0x00000000  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000  

Backtrace: 0x00000000:0x3ffb1d50 0x401361d4:0x3ffb1d70 0x40136241:0x3ffb1d90 0x400d5b42:0x3ffb1db0 0x400d27d6:0x3ffb1f30 0x400d10b6:0x3ffb1f70 0x400d7861:0x3ffb1fb0 0x40088b9d:0x3ffb1fd0

How I tested that is basically with just a loop of the following:

void loop()
{
  string nodeStatus = connection.api.node.status();
  Serial.println(nodeStatus.c_str());
  delay(3000);
}

Tracked down the error to some this github issue:
espressif/arduino-esp32#3347 (see espressif/arduino-esp32#3347 (comment)).

It seems that the following is using a deprecated constructor and as such is causing issues:
https://github.com/ArkEcosystem/cpp-client/blob/751212f0abb395d3ac7b9859b0538842118d4080/src/http/iot/http.cpp#L41

I made a simple workaround for myself which is in no way a general solution but just to demonstrate what worked for me and stopped my controller from rebooting with calling one of the non-deprecated constructors:

  std::string get(const char* request) override {
    WiFiClientSecure client;
    HTTPClient httpClient;
    httpClient.setReuse(false);
    httpClient.setTimeout(3000);

    httpClient.addHeader("Content-Type", "application/json");

    String ret;
    httpClient.begin(client, std::string(std::string(request)).c_str());

    int httpCode = httpClient.GET();
    ret = httpClient.getString();
    httpClient.end();
    return ret.c_str();
  }

Hope that was extensive enough for the issue description!

@ghost
Copy link

ghost commented Apr 26, 2020

Thanks for opening this issue! A maintainer will review this in the next few days and explicitly select labels so you know what's going on.

If no reviewer appears after a week, a reminder will be sent out.

@sleepdefic1t sleepdefic1t added the Status: In Progress The issue or pull request is being worked on. label Apr 27, 2020
@sleepdefic1t
Copy link
Contributor

I'll have a PR that resolves this and #191 soon.

Thank you, @xtrinch

@sleepdefic1t sleepdefic1t mentioned this issue Apr 28, 2020
3 tasks
@sleepdefic1t
Copy link
Contributor

Updates merged to develop.
Feel free to let us know if you have any other questions or concerns.

Thanks again, @xtrinch 👍

@ghost
Copy link

ghost commented May 1, 2020

This issue has been closed. If you wish to re-open it please provide additional information.

@ghost ghost removed the Status: In Progress The issue or pull request is being worked on. label May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants