Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading MQTT_ERROR_TYPE_ESP_TLS error_type when publish failed with TLS disabled (IDFGH-4033) #5906

Closed
AxelLin opened this issue Sep 24, 2020 · 3 comments

Comments

@AxelLin
Copy link
Contributor

AxelLin commented Sep 24, 2020

Environment

  • Module or chip used: ESP32-WROOM-32E
  • IDF version: v4.3-dev-1197-g8bc19ba893e5
  • Build System: idf.py
  • Compiler version: xtensa-esp32-elf-gcc (crosstool-NG esp-2020r3) 8.4.0
  • Operating System: Linux
  • Power Supply: USB

Problem Description

I got MQTT_EVENT_ERROR when publish failed, then check the error_type from event->error_handle->error_type.
It shows MQTT_ERROR_TYPE_ESP_TLS even though I don't use TLS at all.

Expected Behavior

The error_type should make it easier to identify the reason of error.

Actual Behavior

It shows MQTT_ERROR_TYPE_ESP_TLS even when TLS is not used at all.

Steps to reproduce

  1. connect to a mqtt broker (use TCP only, don't enable TLS) and keep publishing data.
  2. stop the broker
  3. the mqtt client got MQTT_EVENT_ERROR but the error_type is MQTT_ERROR_TYPE_ESP_TLS which is obviously wrong.
@github-actions github-actions bot changed the title Misleading MQTT_ERROR_TYPE_ESP_TLS error_type when publish failed with TLS disabled Misleading MQTT_ERROR_TYPE_ESP_TLS error_type when publish failed with TLS disabled (IDFGH-4033) Sep 24, 2020
@Alvin1Zhang
Copy link
Collaborator

Thanks for reporting, we will look into.

david-cermak added a commit to espressif/esp-mqtt that referenced this issue Nov 13, 2020
…orts

Also renamed error type MQTT_ERROR_TYPE_ESP_TLS to
MQTT_ERROR_TYPE_TCP_TRANSPORT, as the former was confusing and might
have implied the error occurred in TLS layer.

Applicable IDF version >= v4.3

Closes espressif/esp-idf#5906
@AxelLin
Copy link
Contributor Author

AxelLin commented Nov 18, 2020

@david-cermak
I got below build error when I build with latest esp-idf (v4.3-dev-1720-g494a124d961c) + master tree of esp-mqtt.
Maybe it's just because some changes in esp-idf is not yet sync to github.
Just FYI, in case if something missed...

error: implicit declaration of function 'esp_transport_get_errno'; did you mean 'esp_transport_set_func'? [-Werror=implicit-function-declaration]
client->event.error_handle->esp_transport_sock_errno = esp_transport_get_errno(client->transport);
^~~~~~~~~~~~~~~~~~~~~~~
esp_transport_set_func

@david-cermak
Copy link
Collaborator

Thanks for the note. yes, correct, the reason is that the latest mqtt needs the latest idf (to get the related socket's errno in case of a failure) which hasn't been yet pushed to GitHub.

espressif-bot pushed a commit that referenced this issue Nov 27, 2020
Updates esp-mqtt reference to include fixes below related mainly to:
* configuration update (disable keepalive, network timeout)
* minor fixes (size_t for all sizes, unbalanced lock, api for
  outbox-size)
* extended error handle to include socket's errno

Closes #5906

Config: Added config value to disable keepalive mechanism
esp-mqtt commit: espressif/esp-mqtt@8562437
Related espressif/esp-mqtt#179

Added esp_mqtt_client_get_outbox_size API
esp-mqtt commit: espressif/esp-mqtt@0a1d9d0
Related espressif/esp-mqtt#178

mqtt_outbox: Removed unused retry_count field from outbox_item_t
esp-mqtt commit: espressif/esp-mqtt@673086e

config: Fixed typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS
esp-mqtt commit: espressif/esp-mqtt@259baae

Fixed missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path
esp-mqtt commit: espressif/esp-mqtt@845c2a3
Related espressif/esp-mqtt#173
Related espressif/esp-mqtt#174

Extended mqtt error handle to capture transport's socket errno (IDF
v4.3+)
esp-mqtt commit: espressif/esp-mqtt@23c8e1e

Config: Added configuration value to set network timeout
esp-mqtt commit: espressif/esp-mqtt@a03228a
Related espressif/esp-mqtt#166

Used size_t for all lengths to allow for other architectures
esp-mqtt commit: espressif/esp-mqtt@b9db8d9
igrr pushed a commit that referenced this issue Nov 27, 2020
Updates esp-mqtt reference to include fixes below related mainly to:
* configuration update (disable keepalive, network timeout)
* minor fixes (size_t for all sizes, unbalanced lock, api for
  outbox-size)
* extended error handle to include socket's errno

Closes #5906

Config: Added config value to disable keepalive mechanism
esp-mqtt commit: espressif/esp-mqtt@8562437
Related espressif/esp-mqtt#179

Added esp_mqtt_client_get_outbox_size API
esp-mqtt commit: espressif/esp-mqtt@0a1d9d0
Related espressif/esp-mqtt#178

mqtt_outbox: Removed unused retry_count field from outbox_item_t
esp-mqtt commit: espressif/esp-mqtt@673086e

config: Fixed typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS
esp-mqtt commit: espressif/esp-mqtt@259baae

Fixed missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path
esp-mqtt commit: espressif/esp-mqtt@845c2a3
Related espressif/esp-mqtt#173
Related espressif/esp-mqtt#174

Extended mqtt error handle to capture transport's socket errno (IDF
v4.3+)
esp-mqtt commit: espressif/esp-mqtt@23c8e1e

Config: Added configuration value to set network timeout
esp-mqtt commit: espressif/esp-mqtt@a03228a
Related espressif/esp-mqtt#166

Used size_t for all lengths to allow for other architectures
esp-mqtt commit: espressif/esp-mqtt@b9db8d9
espressif-bot pushed a commit that referenced this issue Jan 9, 2021
Updates esp-mqtt reference to include fixes below related mainly to:
* configuration update (disable keepalive, network timeout)
* minor fixes (size_t for all sizes, unbalanced lock, api for
  outbox-size)
* extended error handle to include socket's errno

Closes #5906

Config: Added config value to disable keepalive mechanism
esp-mqtt commit: espressif/esp-mqtt@8562437
Related espressif/esp-mqtt#179

Added esp_mqtt_client_get_outbox_size API
esp-mqtt commit: espressif/esp-mqtt@0a1d9d0
Related espressif/esp-mqtt#178

mqtt_outbox: Removed unused retry_count field from outbox_item_t
esp-mqtt commit: espressif/esp-mqtt@673086e

config: Fixed typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS
esp-mqtt commit: espressif/esp-mqtt@259baae

Fixed missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path
esp-mqtt commit: espressif/esp-mqtt@845c2a3
Related espressif/esp-mqtt#173
Related espressif/esp-mqtt#174

Extended mqtt error handle to capture transport's socket errno (IDF
v4.3+)
esp-mqtt commit: espressif/esp-mqtt@23c8e1e

Config: Added configuration value to set network timeout
esp-mqtt commit: espressif/esp-mqtt@a03228a
Related espressif/esp-mqtt#166

Used size_t for all lengths to allow for other architectures
esp-mqtt commit: espressif/esp-mqtt@b9db8d9
espressif-bot pushed a commit that referenced this issue Jan 9, 2021
Updates esp-mqtt reference to include fixes below related mainly to:
* configuration update (disable keepalive, network timeout)
* minor fixes (size_t for all sizes, unbalanced lock, api for
  outbox-size)
* extended error handle to include socket's errno

Closes #5906

Config: Added config value to disable keepalive mechanism
esp-mqtt commit: espressif/esp-mqtt@8562437
Related espressif/esp-mqtt#179

Added esp_mqtt_client_get_outbox_size API
esp-mqtt commit: espressif/esp-mqtt@0a1d9d0
Related espressif/esp-mqtt#178

mqtt_outbox: Removed unused retry_count field from outbox_item_t
esp-mqtt commit: espressif/esp-mqtt@673086e

config: Fixed typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS
esp-mqtt commit: espressif/esp-mqtt@259baae

Fixed missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path
esp-mqtt commit: espressif/esp-mqtt@845c2a3
Related espressif/esp-mqtt#173
Related espressif/esp-mqtt#174

Extended mqtt error handle to capture transport's socket errno (IDF
v4.3+)
esp-mqtt commit: espressif/esp-mqtt@23c8e1e

Config: Added configuration value to set network timeout
esp-mqtt commit: espressif/esp-mqtt@a03228a
Related espressif/esp-mqtt#166

Used size_t for all lengths to allow for other architectures
esp-mqtt commit: espressif/esp-mqtt@b9db8d9
david-cermak added a commit to espressif/esp-mqtt that referenced this issue Dec 16, 2022
Updates esp-mqtt reference to include fixes below related mainly to:
* configuration update (disable keepalive, network timeout)
* minor fixes (size_t for all sizes, unbalanced lock, api for
  outbox-size)
* extended error handle to include socket's errno

Closes espressif/esp-idf#5906

Config: Added config value to disable keepalive mechanism
esp-mqtt commit: 8562437
Related #179

Added esp_mqtt_client_get_outbox_size API
esp-mqtt commit: 0a1d9d0
Related #178

mqtt_outbox: Removed unused retry_count field from outbox_item_t
esp-mqtt commit: 673086e

config: Fixed typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS
esp-mqtt commit: 259baae

Fixed missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path
esp-mqtt commit: 845c2a3
Related #173
Related #174

Extended mqtt error handle to capture transport's socket errno (IDF
v4.3+)
esp-mqtt commit: 23c8e1e

Config: Added configuration value to set network timeout
esp-mqtt commit: a03228a
Related #166

Used size_t for all lengths to allow for other architectures
esp-mqtt commit: b9db8d9
egnor pushed a commit to egnor/esp-mqtt that referenced this issue Dec 23, 2022
Updates esp-mqtt reference to include fixes below related mainly to:
* configuration update (disable keepalive, network timeout)
* minor fixes (size_t for all sizes, unbalanced lock, api for
  outbox-size)
* extended error handle to include socket's errno

Closes espressif/esp-idf#5906

Config: Added config value to disable keepalive mechanism
esp-mqtt commit: espressif@8562437
Related espressif#179

Added esp_mqtt_client_get_outbox_size API
esp-mqtt commit: espressif@0a1d9d0
Related espressif#178

mqtt_outbox: Removed unused retry_count field from outbox_item_t
esp-mqtt commit: espressif@673086e

config: Fixed typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS
esp-mqtt commit: espressif@259baae

Fixed missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path
esp-mqtt commit: espressif@845c2a3
Related espressif#173
Related espressif#174

Extended mqtt error handle to capture transport's socket errno (IDF
v4.3+)
esp-mqtt commit: espressif@23c8e1e

Config: Added configuration value to set network timeout
esp-mqtt commit: espressif@a03228a
Related espressif#166

Used size_t for all lengths to allow for other architectures
esp-mqtt commit: espressif@b9db8d9
egnor pushed a commit to egnor/esp-mqtt that referenced this issue Dec 23, 2022
Updates esp-mqtt reference to include fixes below related mainly to:
* configuration update (disable keepalive, network timeout)
* minor fixes (size_t for all sizes, unbalanced lock, api for
  outbox-size)
* extended error handle to include socket's errno

Closes espressif/esp-idf#5906

Config: Added config value to disable keepalive mechanism
esp-mqtt commit: espressif@8562437
Related espressif#179

Added esp_mqtt_client_get_outbox_size API
esp-mqtt commit: espressif@0a1d9d0
Related espressif#178

mqtt_outbox: Removed unused retry_count field from outbox_item_t
esp-mqtt commit: espressif@673086e

config: Fixed typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS
esp-mqtt commit: espressif@259baae

Fixed missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path
esp-mqtt commit: espressif@845c2a3
Related espressif#173
Related espressif#174

Extended mqtt error handle to capture transport's socket errno (IDF
v4.3+)
esp-mqtt commit: espressif@23c8e1e

Config: Added configuration value to set network timeout
esp-mqtt commit: espressif@a03228a
Related espressif#166

Used size_t for all lengths to allow for other architectures
esp-mqtt commit: espressif@b9db8d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants