fix: add inference mutex to Text Embedding and Text-to-Image#1060
Open
fix: add inference mutex to Text Embedding and Text-to-Image#1060
Conversation
msluszniak
approved these changes
Apr 8, 2026
Member
There was a problem hiding this comment.
With fix, I indeed got segfault on provided demo app code:
04-08 13:39:15.046 5901 5994 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7844af9aec in tid 5994 (RN_ET_Worker2), pid 5901 (com.barern)
04-08 13:39:15.542 6059 6059 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000007844af9aec
when applied changes from this PR, no crashes occur.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds thread-safety to Text Embeddings and Text-to-Image models mirroring what was already done for models inheriting from VisionModel and VAD.
Introduces a breaking change?
Type of change
Tested on
Testing instructions
Use the following app screen and try to trigger the race condition before fix and verify that it doesn't occur after applying the fix. You can use
adb logcat | grep -E "FATAL|SIGSEGV|backtrace"to observe the error on Android.Screenshots
Related issues
#1055
Checklist
Additional notes