Skip to content
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

TinyUPNP library makes my esp8266 crash and reset #48

Open
mustafaosarwala opened this issue Jan 11, 2020 · 18 comments
Open

TinyUPNP library makes my esp8266 crash and reset #48

mustafaosarwala opened this issue Jan 11, 2020 · 18 comments
Labels

Comments

@mustafaosarwala
Copy link

I am trying to open a port on my router using tinyupnp library.
Right now i am trying the example code given in the library. the code compiles fine but after uploading after every few seconds my esp8266 keeps resetting and shows the following error.

501` Not Implemented
Not Implemented
The HTTP Method is not implemented by this server.
called getIGDEventURLs
deviceInfo->actionPath [] deviceInfo->path [/igdevicedesc.xml]
TCP connection timeout while executing getIGDEventURLs
called getIGDEventURLs
deviceInfo->actionPath [] deviceInfo->path [/igdevicedesc.xml]

Soft WDT reset

This keeps happening on a loop continuously and i cant make out what the problem is.
please help.

Log file:
esp8266_tinyupnp_log.txt

@ofekp
Copy link
Owner

ofekp commented Jan 19, 2020

@mustafaosarwala
can you please attach here the result of querying http://192.168.0.1:5431/igdevicedesc.xml?

Please also check that UPnP is enabled in your router.

@mustafaosarwala
Copy link
Author

mustafaosarwala commented Jan 20, 2020

@ofekp
UPNP is enabled on my router.
I tried to disable it and enable it again still not working.
it has a wan interface option with two options one is blank and other is "pppoe 1", i have tried with both the options. default was keeping it blank.
attached is the xml file requested.

igdevicedesc.zip
igdevicedesctxt.txt

@ofekp
Copy link
Owner

ofekp commented Jan 21, 2020

Your router does not answer back to the request to get the file igdevicedesctxt.txt
which is the same file you were able to get when using your browser.

This tells me your router expects some header that we did not provide. I am guessing, though.

This happens in the method getIGDEventURLs.

Let's start with your router model, can you give me the brand and model please, I wanna see if someone had a similar issue?

@ofekp ofekp added the bug label Jan 21, 2020
@mustafaosarwala
Copy link
Author

Its a D-link ADSL Router.
Model : DSL-2730U
If It is a router specific issue then i can try it in some other router and check if the issue persists.
Hope that helps in diagnosis.

@ofekp
Copy link
Owner

ofekp commented Jan 22, 2020

OK, I did not find anything regarding this model. Moreover, the HTTP rfc claims that GET request should never be responded with 501 status code.

Can you give it a try with a different router please?

Also, I am assuming you did not introduce any change to the code, except for the fields that must be set in the example.

@mustafaosarwala
Copy link
Author

I tried it with a portable router and it works fine with the it.
I am still trying to understand what is holding it from getting the xml file from my original router.
It works now but not with my original router.

@ofekp
Copy link
Owner

ofekp commented Jan 25, 2020

OK, we can keep trying to understand what is the issue with your other router.

Are you willing to try to update your router's firmware?

Are you familiar with Postman? It is a program that will let you issue HTTP requests while having control over the headers you send. If you want to keep trying, we will have to reproduce the issue with that program. It will take few iterations but it is worth trying.

Please start by downloading the program from their site https://www.getpostman.com/

You should do a GET request with the following parameters:
Method
GET

URL
http://192.168.0.1:5431/igdevicedesc.xml

Headers

Content-Type: text/xml; charset="utf-8"
Host: 192.168.0.1:5431
Content-Length: 0

Fire it away and let me know what the response was. Did you get the file or the 501 Unsupported error.

@mustafaosarwala
Copy link
Author

Will Surely do.
Learning something new will be fun.
Thanks for showing such enthusiasm Its really appreciated.

Hope this is not taking much of your time.
Thanks once again.

@ofekp
Copy link
Owner

ofekp commented Jan 25, 2020

NP, please do not update the firmware now though.
Let's start with the Postman thing.

I suspect maybe your router is not liking the Content-Length: 0 header. Since this is a GET request.

@mustafaosarwala
Copy link
Author

Postman got the file.
and i have not updated the router firmware.

@ofekp
Copy link
Owner

ofekp commented Jan 25, 2020

Can you please print screen the headers section and the url?

@mustafaosarwala
Copy link
Author

Here is a screen shot of the headers section.

Screenshot (12)

@ofekp
Copy link
Owner

ofekp commented Jan 25, 2020

Can you expand the "Temporary Headers" please?

Can you try switching the method to POST in the top left, right before the URL?
Can you also try to put Content-Length as 1 or 10 and try again?

@mustafaosarwala
Copy link
Author

Here is the screenshot of the temporary headers.
Post Request returns "Bad Request"

The Result is same with Content-Length as 0/1 or 10

Screenshot (13)

@mustafaosarwala
Copy link
Author

Here are the rest of the screenshots.
Thank you.

Screenshot (16)

Screenshot (15)

Screenshot (14)

@ofekp
Copy link
Owner

ofekp commented Jan 25, 2020

Thank you for that.
can you expand that temporary headers section and tell me what's inside? and maybe make sure they are not sent (if possible, I am not sure Postman will let you cancel those but let's try)

@mustafaosarwala
Copy link
Author

mustafaosarwala commented Jan 27, 2020

@ofekp
I am really sorry for the late reply.
These are the temporary headers sent by postman.

User-Agent:PostmanRuntime/7.22.0
Accept:/
Cache-Control:no-cache
Postman-Token:9466445f-a24d-4e8c-afda-4130e11daa8e
Accept-Encoding:gzip, deflate, br
Connection:keep-alive

from which postman only allows to disable cache-control and postman-token which i did disable.
still the same result nothing changed.

I also added these headers in getIGDEventURLs() but it still didnt work.

This is the screenshot of arduino serial monitor after adding the headers. (This is a different esp this one doesnt reset and go on a loop like the other one.

Screenshot (17)

Screenshot (18)

@ofekp
Copy link
Owner

ofekp commented Jan 27, 2020

No worries. OK, can you restore the headers to their original state and then remove only the "Content-Type" header from the code please? (remove the line _wifiClient.println(F("Content-Length: 0"));)

After that, if it does not help, let's go ahead with the firmware update please, and then see if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants