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

WiFiClientSecure gets stuck, when send buffers get full #2494

Closed
everslick opened this issue Feb 22, 2019 · 20 comments
Closed

WiFiClientSecure gets stuck, when send buffers get full #2494

everslick opened this issue Feb 22, 2019 · 20 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@everslick
Copy link
Contributor

When we send too fast (faster then the TLS connection allows), eventually the send buffers will fill up and write() returns 0 (indicating, that nothing could be written). Normally this means we just retry until all data is sent, but in this case the TLS socket never recovers from this condition (buffers stay full). The only thing we can do is close the socket and go home.

@stale
Copy link

stale bot commented Aug 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 1, 2019
@everslick
Copy link
Contributor Author

still valid, don't close.

@stale
Copy link

stale bot commented Aug 1, 2019

This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Aug 1, 2019
@everslick
Copy link
Contributor Author

esp8266/Arduino#6104

could be the same bug as on ESP8266. @me-no-dev ?

@stale
Copy link

stale bot commented Sep 30, 2019

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Sep 30, 2019
@everslick
Copy link
Contributor Author

still relevant, don't close.

@stale
Copy link

stale bot commented Sep 30, 2019

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Sep 30, 2019
@stale
Copy link

stale bot commented Nov 29, 2019

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Nov 29, 2019
@everslick
Copy link
Contributor Author

still relevant, don't close.

@stale
Copy link

stale bot commented Nov 29, 2019

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Nov 29, 2019
@stale
Copy link

stale bot commented Jan 28, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Jan 28, 2020
@stale
Copy link

stale bot commented Feb 11, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Feb 11, 2020
@everslick
Copy link
Contributor Author

https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp#L183

My guess is, when send_ssl_data() returns an error we silently close the socket, and do not inform the caller. write should return int, but returns size_t.

@everslick everslick reopened this Feb 12, 2020
@stale
Copy link

stale bot commented Feb 12, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

1 similar comment
@stale
Copy link

stale bot commented Feb 12, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed Status: Stale Issue is stale stage (outdated/stuck) labels Feb 12, 2020
@everslick
Copy link
Contributor Author

@me-no-dev what do you think?

@stale
Copy link

stale bot commented Apr 12, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Apr 12, 2020
@stale
Copy link

stale bot commented Apr 26, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Apr 26, 2020
@everslick
Copy link
Contributor Author

Doing more tests with idf-release/v4.2 shows the bug still present. So this could very easily be a issue with WiFiClientSecure. It hink this is serious and worth looking into before next stable release. What can I do to bring this foward besides the what I commented above?

everslick added a commit to everslick/Arduino-ESP32-1.0.0 that referenced this issue Feb 17, 2021
mbedTLS requires repeated calls to mbedtls_ssl_write() whenever it returns MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE. this happens when the client sends data faster then the server or the connection can handle.

Fixes: espressif/arduino-esp32#2494
@sansillusion
Copy link

wow I feel bad for you, not even a single aknowledgment of you issue and you have to fight the stale bot to keep it open. I hope you get the attention you need on this issue, unfortunately I can't help.

me-no-dev pushed a commit that referenced this issue Mar 31, 2021
* Fix dropped SSL connection when buffer gets full.

mbedTLS requires repeated calls to mbedtls_ssl_write() whenever it returns MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE. this happens when the client sends data faster then the server or the connection can handle.

Fixes: #2494

* Update ssl_client.cpp

Add vTaskDelay()
me-no-dev pushed a commit that referenced this issue Mar 31, 2021
* Fix dropped SSL connection when buffer gets full.

mbedTLS requires repeated calls to mbedtls_ssl_write() whenever it returns MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE. this happens when the client sends data faster then the server or the connection can handle.

Fixes: #2494

* Update ssl_client.cpp

Add vTaskDelay()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

2 participants