esp-idf: MPI: Timed out waiting for completion of MPI Interrupt (IDFGH-11118)

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.1.1

Operating System used.

Windows

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

PowerShell

Development Kit.

ESP32-S3-WROOM-1 MCN8R8

Power Supply used.

Battery

What is the expected behavior?

i need get a https handle to download file

What is the actual behavior?

Some times, the function is return null, Some times, function return handle and could download the file from https At esp-idf v4.4, the function blow is work ok.

Steps to reproduce.

`HttpsDownloadHandle* https_download_begin(const esp_http_client_config_t * http_config, struct https_download_arg* arg) {

if(http_config == nullptr || arg == nullptr || arg->https_buf == nullptr || arg->https_buf_size < arg->header_size || arg->header_size < 0) { return nullptr; } HttpsDownloadHandle* self = ql_malloc(sizeof(HttpsDownloadHandle)); assert_ret(self, nullptr); memset(self, 0, sizeof(HttpsDownloadHandle)); self->http_client = esp_http_client_init(http_config); if (self->http_client == NULL) { log_error(“Failed to initialise HTTP connection”); goto failure; } esp_err_t err = _http_connect(self->http_client); if (err != ESP_OK) { ESP_LOGE(TAG, “Failed to establish HTTP connection”); goto http_cleanup; } self->state = e_https_download_init; self->arg = *arg; return self; http_cleanup: _http_cleanup(self->http_client); failure: if(self) { ql_free(self); } return nullptr; };`

Config is below:

’ esp_http_client_config_t config = { .url = GET_VER_INFO(this_type).image_path,//https://sleeppydata.oss-cn-beijing.aliyuncs.com/xxx .timeout_ms = 60000, .keep_alive_enable = true, .skip_cert_common_name_check = true, .crt_bundle_attach = esp_crt_bundle_attach, };’

Debug Logs.

is 

E (1243994) MPI: Timed out waiting for completion of MPI Interrupt
(1695375323647) time_sync_task: remote ms 1695375323641
E (1246012) MPI: Timed out waiting for completion of MPI Interrupt
E (1246012) esp-x509-crt-bundle: PK verify failed with error FFFFBD7F
E (1246015) esp-x509-crt-bundle: Failed to verify certificate
E (1246023) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x3000
E (1246028) esp-tls: Failed to open new connection
E (1246034) transport_base: Failed to open a new connection
E (1246041) HTTP_CLIENT: Connection failed, sock < 0
E (1246046) _http_connect: Failed to open HTTP connection: ESP_ERR_HTTP_CONNECT
E (1246053) https_download_begin: Failed to establish HTTP connection

More Information.

No response

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 30 (10 by maintainers)

Most upvoted comments

Hello @chipweinberger, @ves011,

Recently we merged some fixes in the AES and MPI modules that were backported to release/v5.1 as well. I would recommend you to check if the issue still persists with the branch release/v5.1. Fixes that were merged were: AES-DMA related fixes (https://github.com/espressif/esp-idf/commit/2fbe919e4cafba8ce2528e8eaa21bfe7fbbe7d8f and https://github.com/espressif/esp-idf/commit/560518939871895b53db6a55c8d800aa42355894), interrupt related fixes (https://github.com/espressif/esp-idf/commit/4c30f2a4a0229979b4700c6acb34d49705fb6670, https://github.com/espressif/esp-idf/commit/e8a5d9ef989f958be9ea6d07280c13f7601a9f47).

Closing this issue as of now, feel free to re-open if the issue still persists.

These are just workarounds 😦 For me it looks like a degradation which needs to be fixed. @yizi15 had the same problem while migrating the code to v5 (on my understanding) The first step is for espressif guys to accept this is an issue.

@yizi15 you said “i checkout the release/V5.1, and my bug seems to fixed”. Do you know what is the fix?

Again can someone comment what is the impact of disabling CONFIG_MBEDTLS_MPI_USE_INTERRUPT?

Hello

I have the same issue but in different context. Im my case MPI timeout is hit when trying to connect to a MQTT broker with dual authentication Here is the log of the error

E (18:39:51.102) MPI: Timed out waiting for completion of MPI Interrupt E (18:39:53.122) MPI: Timed out waiting for completion of MPI Interrupt E (18:39:55.122) MPI: Timed out waiting for completion of MPI Interrupt E (18:39:55.125) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x2700 I (18:39:55.126) esp-tls-mbedtls: Failed to verify peer certificate! E (18:39:55.126) esp-tls: Failed to open new connection E (18:39:55.127) transport_base: Failed to open a new connection E (18:39:55.130) mqtt_client: Error transport connect I (18:39:55.131) MQTTClient: MQTT_EVENT_ERROR E (18:39:55.132) MQTTClient: Last error reported from esp-tls: 0x801a E (18:39:55.132) MQTTClient: Last error reported from tls stack: 0x2700 I (18:39:55.133) MQTTClient: Last errno string (Success) I (18:39:55.133) MQTTClient: MQTT_EVENT_DISCONNECTED

MQTTClient: tag comes from my mqtt client warpper

I come into this issue while porting the code from 4.4.3 to 5.1.1. On 4.4 everything works fine and no MPI timeot. The strange thing is that i ported 2 applications. App 1 is the main application which connects to the mqtt broker and shows this issue. App 2 is a related OTA application, which the same, connects to mqtt broker, but also to a https server to fetch the firmware, and this one works fine! Both applictions are using the same certificates, and basically the same mqtt client wrapper. Sometimes, right after flashing. app 1 works fine, but after first reset goes into the issue.

The workaround i found is to undef CONFIG_MBEDTLS_MPI_USE_INTERRUPT. After undefining app 1 works fine. Can you comment what is the impact of this workaround?

when i clone the idf, no heap\tlsf found, then i copy the dir from v5.1.1 (download from https://dl.espressif.cn/dl/idf-installer/esp-idf-tools-setup-offline-5.1.1.exe)