Skip to content

fix: Protect acquiring buffer by different workers#805

Closed
msluszniak wants to merge 2 commits intomainfrom
@ms/fix-crash-in-stt
Closed

fix: Protect acquiring buffer by different workers#805
msluszniak wants to merge 2 commits intomainfrom
@ms/fix-crash-in-stt

Conversation

@msluszniak
Copy link
Copy Markdown
Member

@msluszniak msluszniak commented Feb 12, 2026

Description

This PR tries to fix the random BAD_ACCESS error in speech to text. After streaming a while to a model, there was a crash. I suspect that it was generated by the following. When incrementally adding chunks, model has latency and the buffer increases. So it sometimes reallocates to a different part in memory. Function that processes audio and passes it to executorch runtime does not know about reallocation and passes old memory address. When executorch runtime tries to copy the memory now the address is invalid.

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

I run 30 minutes of live transcription on iOS and do not observe the crash. You can check this similar way.

Screenshots

Related issues

Closes #791

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

@msluszniak msluszniak self-assigned this Feb 12, 2026
@msluszniak msluszniak added the bug fix PRs that are fixing bugs label Feb 12, 2026
@msluszniak msluszniak added the pending response This issue awaits some action label Feb 23, 2026
@msluszniak msluszniak changed the title bug-fix: Protect acquiring buffer by different workers fix: Protect acquiring buffer by different workers Feb 25, 2026
@jpark0506
Copy link
Copy Markdown

I have the same error in android emulator. please consider merging this pr. thank you.

@msluszniak
Copy link
Copy Markdown
Member Author

@jpark0506 We will merge this changes probably in #816 which is in review and we this PR will be closed as a subset of these changes. I will ping you once it will be merge to main. In a meantime you can build the library using #816 as a source of truth.

@msluszniak
Copy link
Copy Markdown
Member Author

Closing this in favour of #816

@msluszniak msluszniak closed this Mar 11, 2026
@msluszniak
Copy link
Copy Markdown
Member Author

@jpark0506 change is merged to main :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix PRs that are fixing bugs pending response This issue awaits some action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash during live transcription in Speech-to-Text demo app

2 participants