Comments (19)
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.
Yes url is the same, it is Thingspeak. And I am connecting by domain name.
from esphttpclient.
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.
Try use espconn_delete(conn) before os_free(conn)
// Fix memory leak.
espconn_delete(conn);
os_free(conn);
from esphttpclient.
@dexterkhm Does the fix_memleak branch solve the problem?
from esphttpclient.
I will try today.
from esphttpclient.
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.
I Think problem with heap losing happens when two "http_get" called from different places at same time.
from esphttpclient.
@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.
Nice!!! how can I download fixed files??
from esphttpclient.
@dexterkhm
The temporary URL of fixed files is here:
https://github.com/vowstar/esphttpclient
from esphttpclient.
#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.
@dexterkhm This is to take care of some super slow servers and networks :)
from esphttpclient.
@dexterkhm if 10 sec is ticking while you "http_get" again, you may get 2 reponses(callbacks)
from esphttpclient.
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.
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.
Ok thanks a lot. I will try now.
from esphttpclient.
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.
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)
- esp8266 Fatal exception from http_get HOT 1
- Error: implicit declaration of function HOT 3
- Making PUT requests HOT 2
- SSL support HOT 2
- Some sites response with 'HTTP 1.0' and cause 'error' HOT 4
- esp crashes if server doesn't respond HOT 2
- About keep-alive HOT 1
- Compilation warning HOT 2
- Cannot send binary payload
- compilation error 2 HOT 1
- Ram not enough for SSL HOT 3
- [Feature request] lwIP and mbedTLS port HOT 4
- Body data not followed by \0 when chunked HOT 2
- Lots of POSTs runs out of memory HOT 1
- Why cant we make this library as all other arduino liabraries.
- Error -114
- espconn_gethostbyname issue? HOT 2
- Not working with esp8266 v12e HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esphttpclient.