Code Monkey home page Code Monkey logo

Comments (19)

Caerbannog avatar Caerbannog commented on September 27, 2024

I'm not sure, I don't have an ESP toolchain anymore. Maybe this is inherent to having too many concurrent requests? Would rate-limiting after more than N=5 simultaneous requests be okay for you application?
Or maybe the rate limiting is due to the server side. Are all of your requests done to the same URL? You can try connecting to lots of IPs to see if the problem disappears (213.152.1.81, 213.152.1.82, ... for Google servers).

from esphttpclient.

dexterkhm avatar dexterkhm commented on September 27, 2024

Yes url is the same, it is Thingspeak. And I am connecting by domain name.

from esphttpclient.

Caerbannog avatar Caerbannog commented on September 27, 2024

OK.
It is possible that when thingspeaks receives so many requests it throttles them. The requests take longuer, maybe never finish, so the heap grows.
I suggest trying to temporarily remove the thingspeak domain, instead cycling between a lot of different domains (or IP addresses). This will show if the problem comes from server side throttling.

from esphttpclient.

vowstar avatar vowstar commented on September 27, 2024

Try use espconn_delete(conn) before os_free(conn)
// Fix memory leak.
espconn_delete(conn);
os_free(conn);

from esphttpclient.

Caerbannog avatar Caerbannog commented on September 27, 2024

@dexterkhm Does the fix_memleak branch solve the problem?

from esphttpclient.

dexterkhm avatar dexterkhm commented on September 27, 2024

I will try today.

from esphttpclient.

dexterkhm avatar dexterkhm commented on September 27, 2024

After half a day of testing I am still losing heap. But steps of stable values of heap become longer. It takes about 1 hour of stable heap value then I loose 300 bytes and after come another 1 hour of stable heap value.

from esphttpclient.

dexterkhm avatar dexterkhm commented on September 27, 2024

I Think problem with heap losing happens when two "http_get" called from different places at same time.

from esphttpclient.

vowstar avatar vowstar commented on September 27, 2024

@dexterkhm
I found when server is in debug mode or have no response in half way will caused memory leak.
So I add a timeout method to http request, when server timeout, it will recycle memory automatically.
Please try this.
#15

from esphttpclient.

dexterkhm avatar dexterkhm commented on September 27, 2024

Nice!!! how can I download fixed files??

from esphttpclient.

vowstar avatar vowstar commented on September 27, 2024

@dexterkhm
The temporary URL of fixed files is here:
https://github.com/vowstar/esphttpclient

from esphttpclient.

dexterkhm avatar dexterkhm commented on September 27, 2024

#define HTTP_REQUEST_TIMEOUT_MS (10000) 10seconds??? O_o It is too long as I think. I am struggling now for 3 seconds period. And what happens If I "http_get" it again from somewhere while those 10 sec still ticking?

from esphttpclient.

vowstar avatar vowstar commented on September 27, 2024

@dexterkhm This is to take care of some super slow servers and networks :)

from esphttpclient.

vowstar avatar vowstar commented on September 27, 2024

@dexterkhm if 10 sec is ticking while you "http_get" again, you may get 2 reponses(callbacks)

from esphttpclient.

dexterkhm avatar dexterkhm commented on September 27, 2024

Please try your code in 2-3 seconds "http_get" request period while server is stuck. And what happens with heap at this time?

from esphttpclient.

vowstar avatar vowstar commented on September 27, 2024

In first 10 sec, the heap is decreasing, after 10s, the heap is stable, and when stop http request, the heap is increasing, and then recover, looks like nothing happend.

from esphttpclient.

dexterkhm avatar dexterkhm commented on September 27, 2024

Ok thanks a lot. I will try now.

from esphttpclient.

vowstar avatar vowstar commented on September 27, 2024

Note the http_post API is changed, http header is before http body, and http_delete and http_put have same interface as http_post
void http_post(const char * url, const char * post_data, const char * headers, http_callback user_callback);
changed to
void http_post(const char * url, const char * headers, const char * post_data, http_callback_t callback_handle);


See also
void http_get(const char * url, const char * headers, http_callback_t callback_handle);
void http_delete(const char * url, const char * headers, const char * post_data, http_callback_t callback_handle);
void http_put(const char * url, const char * headers, const char * post_data, http_callback_t callback_handle);

from esphttpclient.

dexterkhm avatar dexterkhm commented on September 27, 2024

I add just your timer func arm and disarm lines, timer callback, added timer var into a structure. And run it .... Well after an while of fast transmite (two timers 3000ms and 15000ms both with httpget)- I still loosing heap that caused with reboot http://s011.radikal.ru/i318/1512/fe/cc45808676c7.jpg

from esphttpclient.

Related Issues (19)

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.