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

fix(client): Make flush() call clear() and deprecate it #10242

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

me-no-dev
Copy link
Member

@me-no-dev me-no-dev commented Aug 26, 2024

This is a compromise for issues caused by #9453

Example output:

/var/folders/74/n3f3k71s7lv_snk832kfgjfw0000gn/T/arduino_modified_sketch_265854/WiFiIPv6.ino: In function 'void wifiConnectedLoop()':
/var/folders/74/n3f3k71s7lv_snk832kfgjfw0000gn/T/arduino_modified_sketch_265854/WiFiIPv6.ino:53:20: warning: 'virtual void NetworkUDP::flush()' is deprecated: Use clear() instead. [-Wdeprecated-declarations]
   53 |     ntpClient.flush();
      |     ~~~~~~~~~~~~~~~^~
In file included from /Users/user/Documents/Arduino/hardware/espressif/esp32/libraries/Network/src/Network.h:14,
                 from /Users/user/Documents/Arduino/hardware/espressif/esp32/libraries/WiFi/src/WiFiGeneric.h:39,
                 from /Users/user/Documents/Arduino/hardware/espressif/esp32/libraries/WiFi/src/WiFiSTA.h:29,
                 from /Users/user/Documents/Arduino/hardware/espressif/esp32/libraries/WiFi/src/WiFi.h:33,
                 from /var/folders/74/n3f3k71s7lv_snk832kfgjfw0000gn/T/arduino_modified_sketch_265854/WiFiIPv6.ino:1:
/Users/user/Documents/Arduino/hardware/espressif/esp32/libraries/Network/src/NetworkUdp.h:68:8: note: declared here
   68 |   void flush();  // Print::flush tx
      |        ^~~~~

This is a compromise for issues caused by #9453
Copy link
Contributor

github-actions bot commented Aug 26, 2024

Messages
📖 🎉 Good Job! All checks are passing!

👋 Hello me-no-dev, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 9cb5dd5

Copy link
Contributor

github-actions bot commented Aug 26, 2024

Test Results

 56 files   -  83   56 suites   - 83   4m 53s ⏱️ - 1h 38m 16s
 21 tests  -   9   21 ✅  -   9  0 💤 ±0  0 ❌ ±0 
135 runs   - 168  135 ✅  - 168  0 💤 ±0  0 ❌ ±0 

Results for commit 9cb5dd5. ± Comparison against base commit cd3d0bf.

This pull request removes 9 tests.
performance.coremark.test_coremark ‑ test_coremark
performance.fibonacci.test_fibonacci ‑ test_fibonacci
performance.psramspeed.test_psramspeed ‑ test_psramspeed
performance.ramspeed.test_ramspeed ‑ test_ramspeed
performance.superpi.test_superpi ‑ test_superpi
test_touch_errors
test_touch_interrtupt
test_touch_read
validation.periman.test_periman ‑ test_periman

♻️ This comment has been updated with latest results.

Copy link
Contributor

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32S30⚠️ +880.00⚠️ +0.01000.000.00
ESP32S20⚠️ +1080.00⚠️ +0.01000.000.00
ESP32C30⚠️ +740.00⚠️ +0.01000.000.00
ESP32C60⚠️ +740.00⚠️ +0.01000.000.00
ESP32H20⚠️ +380.00⚠️ +0.01000.000.00
ESP320⚠️ +1080.00⚠️ +0.01000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32S3ESP32S2ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
Ethernet/examples/ETH_W5500_Arduino_SPI⚠️ +360⚠️ +600⚠️ +320⚠️ +320⚠️ +320⚠️ +720
Ethernet/examples/ETH_W5500_IDF_SPI⚠️ +520⚠️ +560⚠️ +320⚠️ +320⚠️ +320⚠️ +640
Ethernet/examples/ETH_WIFI_BRIDGE⚠️ +280⚠️ +2800000--⚠️ +280
NetworkClientSecure/examples/WiFiClientInsecure⚠️ +440⚠️ +640⚠️ +340⚠️ +340--⚠️ +680
NetworkClientSecure/examples/WiFiClientPSK⚠️ +560⚠️ +600⚠️ +340⚠️ +340--⚠️ +680
NetworkClientSecure/examples/WiFiClientSecure⚠️ +440⚠️ +600⚠️ +340⚠️ +340--⚠️ +680
NetworkClientSecure/examples/WiFiClientSecureEnterprise⚠️ +560⚠️ +600⚠️ +380⚠️ +380--⚠️ +680
NetworkClientSecure/examples/WiFiClientSecureProtocolUpgrade⚠️ +560⚠️ +640⚠️ +380⚠️ +360--⚠️ +720
NetworkClientSecure/examples/WiFiClientShowPeerCredentials⚠️ +360⚠️ +600⚠️ +380⚠️ +380--⚠️ +680
NetworkClientSecure/examples/WiFiClientTrustOnFirstUse⚠️ +560⚠️ +600⚠️ +380⚠️ +360--⚠️ +680
PPP/examples/PPP_Basic⚠️ +520⚠️ +600⚠️ +380⚠️ +380⚠️ +380⚠️ +640
PPP/examples/PPP_WIFI_BRIDGE⚠️ +280⚠️ +2800000--⚠️ +280
WebServer/examples/AdvancedWebServer⚠️ +560⚠️ +600⚠️ +360⚠️ +360--⚠️ +720
WebServer/examples/FSBrowser⚠️ +560⚠️ +600⚠️ +380⚠️ +380--⚠️ +680
WebServer/examples/Filters⚠️ +560⚠️ +640⚠️ +360⚠️ +360--⚠️ +680
WebServer/examples/HelloServer⚠️ +560⚠️ +640⚠️ +380⚠️ +380--⚠️ +720
WebServer/examples/HttpAdvancedAuth⚠️ +880⚠️ +1040⚠️ +740⚠️ +740--⚠️ +1080
WebServer/examples/HttpAuthCallback⚠️ +880⚠️ +1000⚠️ +720⚠️ +720--⚠️ +1000
WebServer/examples/HttpAuthCallbackInline⚠️ +880⚠️ +1080⚠️ +740⚠️ +720--⚠️ +1080
WebServer/examples/HttpBasicAuth⚠️ +880⚠️ +1040⚠️ +720⚠️ +740--⚠️ +1080
WebServer/examples/HttpBasicAuthSHA1⚠️ +840⚠️ +1040⚠️ +720⚠️ +720--⚠️ +1000
WebServer/examples/HttpBasicAuthSHA1orBearerToken⚠️ +760⚠️ +920⚠️ +720⚠️ +720--⚠️ +1040
WebServer/examples/MultiHomedServers⚠️ +560⚠️ +600⚠️ +360⚠️ +360--⚠️ +680
WebServer/examples/PathArgServer⚠️ +600⚠️ +600⚠️ +380⚠️ +380--⚠️ +600
WebServer/examples/SDWebServer⚠️ +560⚠️ +600⚠️ +380⚠️ +380--⚠️ +680
WebServer/examples/SimpleAuthentification⚠️ +560⚠️ +640⚠️ +360⚠️ +360--⚠️ +720
WebServer/examples/UploadHugeFile⚠️ +560⚠️ +640⚠️ +380⚠️ +380--⚠️ +680
WebServer/examples/WebServer⚠️ +560⚠️ +600⚠️ +380⚠️ +380--⚠️ +680
WebServer/examples/WebUpdate⚠️ +560⚠️ +640⚠️ +360⚠️ +360--⚠️ +600
WiFi/examples/FTM/FTM_Initiator⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/FTM/FTM_Responder⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/SimpleWiFiServer⚠️ +560⚠️ +600⚠️ +360⚠️ +360--⚠️ +680
WiFi/examples/WPS⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiAccessPoint⚠️ +560⚠️ +600⚠️ +360⚠️ +360--⚠️ +680
WiFi/examples/WiFiBlueToothSwitch⚠️ +280--0000--⚠️ +280
WiFi/examples/WiFiClient⚠️ +560⚠️ +600⚠️ +360⚠️ +360--⚠️ +720
WiFi/examples/WiFiClientBasic⚠️ +560⚠️ +600⚠️ +380⚠️ +380--⚠️ +1040
WiFi/examples/WiFiClientConnect⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiClientEnterprise⚠️ +560⚠️ +600⚠️ +360⚠️ +360--⚠️ +680
WiFi/examples/WiFiClientEvents⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiClientStaticIP⚠️ +600⚠️ +600⚠️ +380⚠️ +380--⚠️ +720
WiFi/examples/WiFiExtender⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiIPv6⚠️ +320⚠️ +320⚠️ +20⚠️ +20--⚠️ +320
WiFi/examples/WiFiMulti⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiMultiAdvanced⚠️ +560⚠️ +640⚠️ +360⚠️ +380--⚠️ +720
WiFi/examples/WiFiScan⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiScanAsync⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiScanDualAntenna⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiScanTime⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiSmartConfig⚠️ +280⚠️ +2800000--⚠️ +280
WiFi/examples/WiFiTelnetToSerial⚠️ +560⚠️ +640⚠️ +380⚠️ +400--⚠️ +680
WiFi/examples/WiFiUDPClient⚠️ +640⚠️ +640⚠️ +360⚠️ +380--⚠️ +720
Ethernet/examples/ETH_LAN8720----------⚠️ +640
Ethernet/examples/ETH_TLK110----------⚠️ +640

@JAndrassy
Copy link
Contributor

JAndrassy commented Aug 26, 2024

but there are multiplatform libraries which invoke flush() for TX and they will get the deprecation warning too and may unintentionally discard RX data. flush is virtual so even if invoked on a base class pointer it would discard RX data.

@VojtechBartoska VojtechBartoska added the Area: WiFi Issue related to WiFi label Aug 26, 2024
@VojtechBartoska VojtechBartoska added this to the 3.0.5 milestone Aug 26, 2024
@Jason2866
Copy link
Collaborator

Jason2866 commented Aug 26, 2024

@JAndrassy Ten times better than your code breaking change!! Still there is the possibility to revert the unneeded PR completely.

@VojtechBartoska VojtechBartoska added the Status: Review needed Issue or PR is awaiting review label Aug 26, 2024
@JAndrassy
Copy link
Contributor

@Jason2866 loosing RX data is not good.

@me-no-dev
Copy link
Member Author

but there are multiplatform libraries which invoke flush() for TX and they will get the deprecation warning too

if those libs worked on ESP32, then they would expect to really clear(), so getting the deprecation warning is OK.

@JAndrassy
Copy link
Contributor

JAndrassy commented Aug 26, 2024

@me-no-dev multiplatform libraries which don't care about the specific platform and just are at risk not working correctly on the esp32 platform. for example some library which prints to a provided Print pointer

@TD-er
Copy link
Contributor

TD-er commented Aug 26, 2024

but there are multiplatform libraries which invoke flush() for TX and they will get the deprecation warning too and may unintentionally discard RX data. flush is virtual so even if invoked on a base class pointer it would discard RX data.

This deprecated warning is only shown when calling this virtual function if it is an instance of these 2 classes right?

Would it be better to suggest to check if change to clear() is needed then?
Or are you referring to making flush() call clear() ?

@me-no-dev multiplatform libraries which don't care about the specific platform and just are at risk not working correctly on the esp32 plaform

The alternative is what we're dealing with now, that existing ESP32 code is no longer working.
So I do think we all realize now what a terrible mess this has become.

@me-no-dev
Copy link
Member Author

@JAndrassy you need to be able to accept some compromise. Breaking ESP specific libs is also not a good thing. This is such compromise that will allow libs to move to clear and in the future have your way.

@me-no-dev me-no-dev added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Aug 27, 2024
@me-no-dev me-no-dev merged commit 7633653 into master Aug 28, 2024
97 checks passed
@me-no-dev me-no-dev deleted the re_flush_to_clear branch August 28, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: WiFi Issue related to WiFi Status: Pending Merge Pull Request is ready to be merged
Projects
Development

Successfully merging this pull request may close these issues.

5 participants