espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.33k stars 7.2k forks source link

[TW#26192] Allocation Failed Errr generated in esp_http_client.c #2395

Closed VallariTrivedi closed 5 years ago

VallariTrivedi commented 6 years ago

----------------------------- Delete below -----------------------------

If your issue is a general question, starts similar to "How do I..", or is related to 3rd party development kits/libs, please discuss this on our community forum at esp32.com instead.

INSTRUCTIONS

Before submitting a new issue, please follow the checklist and try to find the answer.

If the issue cannot be solved after the steps before, please follow these instructions so we can get the needed information to help you in a quick and effective fashion.

  1. Fill in all the fields under Environment marked with [ ] by picking the correct option for you in each case and deleting the others.
  2. Describe your problem.
  3. Include debug logs on the monitor or the coredump.
  4. Provide more items under Other items if possible can help us better locate your problem.
  5. Use markup (buttons above) and the Preview tab to check what the issue will look like.
  6. Delete these instructions from the above to the below marker lines before submitting this issue.

----------------------------- Delete above -----------------------------

Environment

Problem Description

Hi, I have developed an application to post http req at regular intervals to a remote server. This application uses esp_http_client.c library. After few iterations of http post req, I see "Allocation Failed" Error and http req fails.

Expected Behavior

http req should post successfully in all iterations

Actual Behavior

http post req fails due to allocation failed err from http_client

Steps to repropduce

  1. step1-
  2. ...

// It helps if you attach a picture of your setup/wiring here.

Code to reproduce this issue

// the code should be wrapped in the ```cpp tag so that it will be displayed better.
#include "esp_log.h"

void app_main()
{

}

// If your code is longer than 30 lines, GIST is preferred.

Debug Logs

Debug log goes here, should contain the backtrace, as well as the reset source if it is a crash.
Please copy the plain text here for us to search the error log. Or attach the complete logs but leave the main part here if the log is *too* long.

Other items if possible

liuzfesp commented 5 years ago

@zhangyanjiao please help

jitin17 commented 5 years ago

@VallariTrivedi Can you share snippet of how you are sending http post req at regular intervals? It seems likely that you are invoking esp_http_client_init() API multiple times without calling esp_http_client_cleanup() API at the end of each iteration of request, which is resulting in "Allocation failed" error.

Alvin1Zhang commented 5 years ago

@VallariTrivedi Could you help share if any updates for this issue? Thanks.

VallariTrivedi commented 5 years ago

@jitin17 I added esp_http_client_cleanup() to the calling API. This solves "Allocation Failed" error.

VallariTrivedi commented 5 years ago

@VallariTrivedi Could you help share if any updates for this issue? Thanks.

I no longer get "Allocation Failed" error. Thankyou for your support.