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

Allow to configure network timeout (IDFGH-3905) #166

Closed
wants to merge 1 commit into from
Closed

Allow to configure network timeout (IDFGH-3905) #166

wants to merge 1 commit into from

Conversation

dshil
Copy link
Contributor

@dshil dshil commented Aug 27, 2020

No description provided.

@dshil
Copy link
Contributor Author

dshil commented Aug 27, 2020

Hi @david-cermak, the origins of this PR is the following.

I have a secure connection to the MQTT broker. Sometimes WiFi stack is stacked for ~10seconds and network timeout is also 10 seconds, thus in most of the cases the connection is aborted and the reconnect process is issued. Since I use mbedTLS the reconnect process is very expensive (as you might know). My device has too few heap size and I want to avoid scenarios when I run out of heap.

For me, the simplest solution is to increase this timeout and to avoid the connection to be aborted. That's why I want this option to be configurable.

P.S. the initial error I had is:

13:00:41.881 [err] esp-idf: E (288902) MQTT_CLIENT: Error write data or timeout, written len = 0, errno=11

Then I tried to manually set it to 20s and then to 30s - work perfectly for me.

@github-actions github-actions bot changed the title Allow to configure network timeout Allow to configure network timeout (IDFGH-3905) Aug 27, 2020
@david-cermak
Copy link
Collaborator

Hi @dshil

Thanks for posting this PR! LGTM, cherry-picked as a03228a
I agree that having the network timeout configurable is a good thing. I've just added notes about default values and moved the option to the end of the struct.

@dshil dshil deleted the dshil/network-timeout branch September 2, 2020 14:14
@dshil
Copy link
Contributor Author

dshil commented Sep 2, 2020

Hi @david-cermak and thanks!

The last question, I need this change in IDF-v4.2, is it possible to update the corresponding submodule to the latest version in esp-idf repo? If yes I will prepare a PR.

@david-cermak
Copy link
Collaborator

@dshil Yes, no problem to reference this commit in v4.2 of IDF. We typically merge such IDF commit to master first and then backport it to all major releases. No need to post a PR to IDF repo for that, we usually do that automatically, but please be patient with us, as it might take some time until it gets pushed to the release branches.

@dshil
Copy link
Contributor Author

dshil commented Sep 3, 2020

@david-cermak got it. Will wait for the backport.
Thanks!

@dshil
Copy link
Contributor Author

dshil commented Sep 14, 2020

Hi @david-cermak, apologies for the reminder but it seems that the option still not ported to master branch, correct? I understand you have a lot of another work to do, but probably I can elaborate somehow to speedup the process?

@dshil
Copy link
Contributor Author

dshil commented Oct 23, 2020

Hi @david-cermak, almost 1.5 months have passed and I just checked the esp-mqtt component in master branch, no updates. Probably it is updated internally. Anyway, I am very interested in this configuration parameter, any chance to see it in the upcoming v4.2 release?

espressif-bot pushed a commit to espressif/esp-idf that referenced this pull request 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 to espressif/esp-idf that referenced this pull request 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
jack0c pushed a commit to espressif/esp-idf that referenced this pull request Dec 10, 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 to espressif/esp-idf that referenced this pull request 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 to espressif/esp-idf that referenced this pull request 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 that referenced this pull request 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 pull request 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 pull request 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

Successfully merging this pull request may close these issues.

2 participants