Skip to content

Retry loading fallback fonts in case of network errors - #3152

Merged
Konstantin (terrakok) merged 3 commits into
jb-mainfrom
CMP-10324
Jun 23, 2026
Merged

Retry loading fallback fonts in case of network errors#3152
Konstantin (terrakok) merged 3 commits into
jb-mainfrom
CMP-10324

Conversation

@terrakok

Copy link
Copy Markdown
Member

Issue: If an error occurred while loading a fallback font for an unresolved symbol (e.g., a network failure), the batch of codepoints was silently lost. Due to deduplication in the UnresolvedSymbolsRegistry and caching of the Skia paragraph in the ParagraphLayouter, the character was considered “already processed” and was never reported again—it remained unrenderable (tofu) forever, even after network recovery.
Solution: In WebFallbackFontDownloader, a failed batch is no longer lost: it is resubmitted for re-download via a non-blocking coroutine with a linear backoff (5s * errorCount), which is reset upon any successful download. A successful retry follows the standard flow (onFontsLoaded → onNewFontInstalled()), invalidates the paragraph cache, and redraws the text. The ParagraphLayouter remains unchanged.

Fixes https://youtrack.jetbrains.com/issue/CMP-10324

Testing

Added tests cases

Release Notes

Fixes - Web

  • Web: retry loading fallback fonts in case of network errors
- Added linear backoff mechanism for retries on font download failures.
- Enhanced error handling by throwing when all font downloads fail.
- Improved logging to include retry delay and failure details.
…ehavior

- Added test cases to validate retry logic with same codepoints on failure.
- Introduced tests for linear backoff mechanism with retry delays.
- Ensured success resets backoff and worker continues processing new batches despite failures.
- Ensured retry logic only triggers when fonts list is non-empty and all entries are null.
@terrakok
Konstantin (terrakok) merged commit b62dcc3 into jb-main Jun 23, 2026
17 of 18 checks passed
@terrakok
Konstantin (terrakok) deleted the CMP-10324 branch June 23, 2026 13:30
Apolo (ApoloApps) pushed a commit to ApoloApps/compose-multiplatform-core that referenced this pull request Jul 20, 2026
**Issue:** If an error occurred while loading a fallback font for an
unresolved symbol (e.g., a network failure), the batch of codepoints was
silently lost. Due to deduplication in the UnresolvedSymbolsRegistry and
caching of the Skia paragraph in the ParagraphLayouter, the character
was considered “already processed” and was never reported again—it
remained unrenderable (tofu) forever, even after network recovery.
**Solution:** In WebFallbackFontDownloader, a failed batch is no longer
lost: it is resubmitted for re-download via a non-blocking coroutine
with a linear backoff (5s * errorCount), which is reset upon any
successful download. A successful retry follows the standard flow
(onFontsLoaded → onNewFontInstalled()), invalidates the paragraph cache,
and redraws the text. The ParagraphLayouter remains unchanged.

Fixes https://youtrack.jetbrains.com/issue/CMP-10324

## Testing
Added tests cases

## Release Notes
### Fixes - Web
- Web: retry loading fallback fonts in case of network errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants