Skip to content

http.GET() return connection refused error (-1) #6169

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
comertial opened this issue May 31, 2019 · 6 comments
Closed

http.GET() return connection refused error (-1) #6169

comertial opened this issue May 31, 2019 · 6 comments

Comments

@comertial
Copy link

Basic Infos

  • [x ] This issue complies with the issue POLICY doc.
  • [x ] I have read the documentation at readthedocs and the issue is not addressed there.
  • [x ] I have tested that the issue is present in current master branch (aka latest git).
  • [x ] I have searched the issue tracker for a similar issue.
  • [x ] If there is a stack dump, I have decoded it.
  • [x ] I have filled out all fields below.

Platform

  • Hardware: [ESP-12]
  • Core Version: [latest git hash or date]
  • Development Env: [Arduino IDE]
  • Operating System: [Windows]

Settings in IDE

  • Module: [NodeMCU 1.0 (ESP-12E Module)]
  • Flash Size: [4MB/1MB]
  • lwip Variant: [v2 Lower Memory]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

I try to get my public ip with the ipify, but running the code i get connection refused.. i use the BasicHttpClient exactly as it is and i just change my ssid and password and the http.begin("http://api.ipify.org/");! thats all the changes but i get a connection refused.. until yesterday everything was working fine!
I also tried the same example without changing anything else other than my ssid and passoword but again the same problem occurs!

Debug Messages

on serial monitor this is what is being printed:

[SETUP] WAIT 4...
[SETUP] WAIT 3...
[SETUP] WAIT 2...
[SETUP] WAIT 1...
[HTTP] begin...
[HTTP] GET...
[HTTP] GET... failed, error: connection refused
@5chufti
Copy link
Contributor

5chufti commented Jun 1, 2019

so, and instead of waiting and seeing if this isn't just an error of ipify.org, you open an issue???
please check again - see that it works now - close this issue and think twice next time.
This is no board for general problems with esp and arduino. To handle such "issues" please use boards lie http://www.esp8266.com

@comertial
Copy link
Author

comertial commented Jun 1, 2019

i gave ipify as an example.. i also tried what is my ip api but again the same problem occurs... i also tried to http.begin("http://google.com/"); but again connection was refused.. finaly i just run the example without changing anything but again the problem is the same!! so.. i am sure that its not ipify's problem nor what is my ip's problem nor google's problem and probably its something wrong with the library, or the example, or i dont even know because if i knew it would be solved by me.. so this is the reason i opened the issue!
thanks in advance!

@d-a-v
Copy link
Collaborator

d-a-v commented Jun 17, 2019

@comertial enable debug mode (tools menu), and give all output from the BasicHttpClient sketch.

@comertial
Copy link
Author

For some reason that I can't explain resetting my modem did the job!

@teo1978
Copy link
Contributor

teo1978 commented Oct 6, 2019

Actually I was (or am) observing the same issue: random but persistent failures to connect reporting bogus "connection refused" errors.

By "random but persistent" I mean that I would randomly start having the issue when connecting to a new AP (same sketch and board that had been connecting to another AP for months without issues), and then it would persist, and then some day it would disappear. Of course I was tinkering with several parameters and every time I thought I had worked around it by changing something.

Today the issue went away after upgrading to the latest version of this project, but now I realise, I have also reset the router/AP, which in my case is my Android phone with Portable Hotspot turned on (by reset it I mean I turned Portable Hotspot off and on).

So, I wonder whether the issue has been fixed in a recent release, or if this is yet another instance of it going away randomly after resetting the router.

I had given some detailed debug output in
#5137

In that particular report I was assuming that nothing was wrong in the http client itself (or wifi client or any layer below it) and I was originally reporting the lack of detail in the error reporting, which actually turned out to be plain wrong error reporting (bogus "connection refused" when no connection was being refused), but then it became clear that there IS something wrong in the client.

So, is the issue (randomly failing http GETs and bogus "connection refused" errors) known to have been fixed?

@teo1978
Copy link
Contributor

teo1978 commented Oct 6, 2019

Ok, no, it's not fixed.

I downgraded back to the version I was using (somewhere after a1e59e9, not much later) and I still can't reproduce the issue, with the same sketch and same board and same router (my Android phone ad portable hotspot) where I was observing the issue in the first place, and where I stopped observing it today after upgrading. But now downgrading doesn't bring back the issue, so it's clear it simply randomly disappeared as it did many times before, just as randomly as it often reappears.

This issue is real and should be reopened, and it seems to be related to what I reported in #5137

I also wonder whether this is related to #4176
(see my comments starting from #4176 (comment))

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

4 participants