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

ESP32-S3 specific WS message lengths cause WS frame is not properly masked error (IDFGH-14461) #15235

Open
3 tasks done
higaski opened this issue Jan 20, 2025 · 1 comment
Open
3 tasks done
Assignees
Labels
Status: Opened Issue is new Type: Bug bugs in IDF

Comments

@higaski
Copy link
Contributor

higaski commented Jan 20, 2025

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

ESP-IDF v5.4

Espressif SoC revision.

ESP32-S3 (QFN56) (revision v0.1)

Operating System used.

Linux

How did you build your project?

Command line with CMake

If you are using Windows, please specify command line type.

None

Development Kit.

ESP32-S3 WROOM2 custom board

Power Supply used.

External 3.3V

What is the expected behavior?

Transmitting WebSocket messages of any length should not be an issue.

What is the actual behavior?

I think there still is an issue when transmitting WebSocket messages of a particular length. I have an application which used to transmit 268B messages in bursts of 256 messages at a time. This worked flawlessly so far. Due to changed requirements the message size decreased from 268 to 263B and suddenly ESP-IDF is throwing WS frame is not properly masked errors at me.

Doing some research I think that this might be related to #14473, #14704 or #14706?
Apparently a particular message size transmitted at a specific pattern (263B x 256 in this case) is problematic.

Steps to reproduce.

  1. Use the following example https://github.com/higaski/esp_idf_issue_15235
  2. Provide WiFi credentials in main.cpp
    #define MY_SSID ""
    #define MY_PASSWORD ""
  3. Flash the example onto an ESP32-S3-DevKitC-1 (must be a 32MB flash one, e.g. N32R8V)
  4. Open the ws_send.py script (requires websocket-client)
  5. Replace the IP address with the one assigned to the ESP32
  6. Run the script

Debug Logs.

I (9245) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (9245) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (9255) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (10465) esp_netif_handlers: sta ip: 192.168.1.122, mask: 255.255.255.0, gw: 192.168.1.250
I (10465) esp_idf_issue_15235: got ip: 192.168.1.122
I (47935) wifi:<ba-add>idx:1 (ifx:0, 18:a6:f7:df:6d:b5), tid:0, ssn:0, winSize:64
I (48065) esp_idf_issue_15235: WS open
W (49805) httpd_ws: httpd_ws_recv_frame: WS frame is not properly masked.

More Information.

No response

@higaski higaski added the Type: Bug bugs in IDF label Jan 20, 2025
@github-actions github-actions bot changed the title ESP32-S3 specific WS message lengths cause WS frame is not properly masked error ESP32-S3 specific WS message lengths cause WS frame is not properly masked error (IDFGH-14461) Jan 20, 2025
@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 20, 2025
higaski added a commit to OpenRemise/Firmware that referenced this issue Jan 20, 2025
higaski added a commit to OpenRemise/Frontend that referenced this issue Jan 20, 2025
@higaski
Copy link
Contributor Author

higaski commented Jan 20, 2025

OK, of course it didn't leave me alone. I've tried to create a minimal repro here:
https://github.com/higaski/esp_idf_issue_15235

It contains some HTTP / WS code which reads the received data into a std::vector and then transmits a 0-6 byte random response back. The WS requests are sent from a simple Python script.

Sadly I couldn't reproduce the issue yet. Maybe Python is too slow to burst send the messages fast enough? The original code uses a Web-App to send the data. Maybe the timing is critical.

/edit
😄
ok, couple of seconds later, splitting the Python send/recv into two different loops, it now repros immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants