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

USB: Fix file writing hang regression for big files #3622

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Willy-JL
Copy link
Contributor

@Willy-JL Willy-JL commented May 1, 2024

What's new

  • Fixes USB: File writing hang regression for big files #3452 as it is still an issue
  • TLDR:
    • [FL-3672] CLI: cat command crash workaround #3358 fixed crashes when using cat on flipper serial
    • it also included some unrelated USB CDC parameter changes
    • from what I've tested, the crash for cat on serial is fixed even when not including the USB CDC changes
    • this additional unrelated change was only denoted as USB CDC: switch from 2x unidirectional data endpoints to 1x bidirectional
    • from what I can see there are no additional details, no bugs this is attempting to fix, and no improvements this brings
    • there are however some very real issues with this tiny USB CDC changes
    • during USB file writing (like qFlipper or Web update) there is a random chance of USB lockup
    • when this happens, Flipper USB will be fully unresponsive until rebooted
    • qFlipper will say timeout after some seconds, Web will just remain stuck forever
    • the bigger the file being written over USB, the higher chance of lockup
    • it is most prominent when installing some big CFW (6MB+ resources.tar), but I have seen multiple users struggling to update OFW due to this bug
    • in other cases I told people to downgrade to older OFW to avoid this bug, and they could not even downgrade due to having newer OFW currently installed with this bug
    • CFWs have reverted this changes in same way as this PR and have had no issues since. going from CFW to new CFW, or from CFW to OFW
    • but since OFW after 0.99 has this bug, if user has OFW installed they can have issues updating to newer OFW or installing CFW

Verification

  • Install firmware with big resources.tar multiple times and no issues

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

They cause issues with qFlipper tgz update and webupdater too
Happens randomly, much more likely on big files however
Especially big resources.tar (6MB and more) almost always fail
Write operation will randomly hang throughout and cause timeout
Flipper USB becomes unresponsive afterwards
@skotopes
Copy link
Member

skotopes commented May 1, 2024

#3358 actually fixes two problems:

  • dual endpoint configuration causes linux to send garbage to the device
  • line buffer overflow in cli caused by garbage sent to the device

So what you doing here is breaking first one. I'd rather see proper fix that is finding root cause of single endpoint cdc crash.

@Willy-JL
Copy link
Contributor Author

Willy-JL commented May 1, 2024

I see, thanks for clearing that up. It's the crucial piece of information that wasn't specified anywhere (atleast as far as I could see).

I'll try to find out more but it is really difficult to debug, there are no weird logs or crashes usually, just stops working. It almost feels like random memory corruption.

@Willy-JL Willy-JL marked this pull request as draft May 1, 2024 04:37
@hedger hedger added Bug Core+Services HAL, furi & core system services USB BadUSB + physical USB interface labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Core+Services HAL, furi & core system services USB BadUSB + physical USB interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

USB: File writing hang regression for big files
3 participants