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

Got confusing MQTT_EVENT_ERROR (IDFGH-4405) #182

Closed
AxelLin opened this issue Dec 10, 2020 · 1 comment
Closed

Got confusing MQTT_EVENT_ERROR (IDFGH-4405) #182

AxelLin opened this issue Dec 10, 2020 · 1 comment

Comments

@AxelLin
Copy link
Contributor

AxelLin commented Dec 10, 2020

Sometimes I got MQTT_EVENT_ERROR with error_type MQTT_ERROR_TYPE_TCP_TRANSPORT.
But all the errors (esp_tls_last_esp_err, esp_tls_stack_err, esp_tls_cert_verify_flags, sock_errno) shows 0.
I didn't use TLS in my test, so I'm not surprised the esp_tls_* are 0, but sock_errno is also 0, this is quite confusing.

It looks like this happen when
mqtt_write_data
esp_transport_write returns 0.
i.e. MQTT_CLIENT: Error write data or timeout, written len = 0, errno=0

When disable ESP_LOG, there is no good way to know what's wrong if all the err fields are 0.
So I'm wondering if there is some way to improve this.

@github-actions github-actions bot changed the title Got confusing MQTT_EVENT_ERROR Got confusing MQTT_EVENT_ERROR (IDFGH-4405) Dec 10, 2020
@david-cermak
Copy link
Collaborator

@AxelLin But the client still disconnects after this error, or? I think we abort connection if the mqtt_write_data() not ESP_OK. The reason could be that the connection terminated in a clean way, with the FIN flag, in that case the errno would be 0.

Yes, in general we'd like add records for these three "errors" that are not reflected in sockets' errno (on the tcp-transport layer)

  • select/connection timeout
  • DNS resolve issue
  • closing connection with FIN flag

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

2 participants