Git Product home page Git Product logo

Comments (9)

boblemaire avatar boblemaire commented on September 4, 2024

from asynchttprequest.

andrewk123 avatar andrewk123 commented on September 4, 2024

Here you go... I've left some of my debug messages in there which you (hopefully) will be able to match to the scenario above.

Note that the "crash" occurs right at the time that the response from the third request (the one launched with a http.readyState() of 0) would be expected to arrive.

[6709] Ready State: 0
[6709] Push Sent
Debug(6710): setDebug(on) version 1.1.15
Debug(6710): open(GET, http://192.168.59.184:2002/?valu)
Debug( 1): _parseURL() HTTP://192.168.59.184:2002/?value=1
Debug( 6): _connect()
Debug( 11): send()
Debug( 11): _buildRequest()
Debug( 12): _send() 126
Debug( 14): *can't send
Debug(30127): _onError handler error=-13
Debug(30128): _onDisconnect handler
Debug(30128): _setReadyState(4)
[36838] HTTP Status Code:-4
Debug(30129): responseText() Debug(30131): responseText() no data
[43161] Ready State: 4
[43161] Push Sent
Debug(36452): setTimeout(2)
Debug(36452): setDebug(on) version 1.1.15
Debug(36452): open(GET, http://192.168.59.184:2002/?valu)
Debug( 1): _parseURL() HTTP://192.168.59.184:2002/?value=0
Debug( 5): _connect()
Debug( 9): send()
Debug( 10): _buildRequest()
Debug( 12): _send() 126
Debug( 14): *can't send
Debug(30845): _onError handler error=-13
Debug(30845): _onDisconnect handler
Debug(30846): _setReadyState(4)
[74011] HTTP Status Code:-4
Debug(30846): responseText() Debug(30849): responseText() no data
[80021] Ready State: 4
[80021] Push Sent
Debug(36857): setTimeout(2)
Debug(36857): setDebug(on) version 1.1.15
Debug(36857): open(GET, http://192.168.59.184:2002/?valu)
Debug( 1): _parseURL() HTTP://192.168.59.184:2002/?value=0
Debug( 5): _connect()
Debug( 9): send()
Debug( 10): _buildRequest()
Debug( 12): _send() 126
Debug( 14): *can't send
[88459] Ready State: 0
[88460] Push Sent
Debug(8435): setTimeout(2)
Debug(8435): setDebug(on) version 1.1.15
Debug(8435): open(GET, http://192.168.59.184:2002/?valu)
Debug( 1): _parseURL() HTTP://192.168.59.184:2002/?value=1
Debug( 6): _connect()
Debug( 9): send()
Debug( 9): _buildRequest()
Debug( 12): _send() 126
Debug( 14): *can't send
Debug(21244): _onError handler error=-13
Debug(21245): _onDisconnect handler
Debug(21245): _setReadyState(4)
[109709] HTTP Status Code:-4
Debug(21246): responseText() Debug(21249): responseText() no data

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

from asynchttprequest.

andrewk123 avatar andrewk123 commented on September 4, 2024

I had a quick look at this. The restart appears to be caused by (in my example above) the second connection attempt de-allocating _client when the onDisconnect handler fires while the the third connection attempt is still active. The third attempt then tries to re-use the already deallocated _client causing the restart. As I said, I can work around this by looking for the http.readyState() to be 4 (not 0) (after the first connect attempt) and queuing/retrying subsequent messages until the previous attempt has timed out. This stops the resets.

However, we still have the issue that there is a (+/-) 30 sec timeout before the onDisconnect event turns up even though the application "knows" it "*can't send" after less than 20 ms. Any thoughts on how to abort the connection and/or fire the onDisconnect event? I've tried using the abort() command after a timeout however that has no effect. Any thoughts appreciated.

from asynchttprequest.

miwied avatar miwied commented on September 4, 2024

Hello, I have the excact same problems.

Here is my example code and here is the reboot msg.

from asynchttprequest.

miwied avatar miwied commented on September 4, 2024

@andrewk123 did you solve the timout problem?

from asynchttprequest.

andrewk123 avatar andrewk123 commented on September 4, 2024

I tried AsyncHTTPRequest_Generic and found the same issue, however Khoi was able to resolve it so I use that version now. It's functionally identical to asyncHTTPrequest. There were some small changes to integrate it but nothing that took more than a few minutes. The fix was in 1.4.0.

https://github.com/khoih-prog/AsyncHTTPRequest_Generic

from asynchttprequest.

miwied avatar miwied commented on September 4, 2024

@andrewk123 Hi first of all thanks for your answer!

Thats actually pretty funny because I struggeled for weeks to get either boblemaire's or khoih-progs library to work properly.
After days of no success I created a issue which let khoih to make a new version with a fix. Here is his answer to my issue.

Unfortunately till today I didn't get a working version..
After the "fix" it still takes always 18 seconds to get a bad connection response. You can see my demo-code + debug output here.

Which microcontroller do you use?

from asynchttprequest.

boblemaire avatar boblemaire commented on September 4, 2024

Looks like a solution was found in another's fork.

from asynchttprequest.

miwied avatar miwied commented on September 4, 2024

@boblemaire Wich one?

from asynchttprequest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.