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

Make Skia context usage a critical section on iOS. #896

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

elijah-semyonov
Copy link

@elijah-semyonov elijah-semyonov commented Nov 6, 2023

Proposed Changes

Since there are no reliable repros, it's a speculative fix for the crash on iOS.
It's based on an assumption that the case for the crash is caused by render command encoding in a separate thread being performed after (or in parallel) with the context disposal on the main thread which leads to incorrect state inside Skia.

Testing

Test: see if issues persists.

Issues Fixed

Fixes: JetBrains/compose-multiplatform#3862

Note

Skia is supposed to handle internal resources based on reference counting and assumed scenario shouldn't lead to the crash, since the context should be indirectly retained by the moment encoding starts.
Revert if issue persists because that logic would be redundant.

@elijah-semyonov elijah-semyonov self-assigned this Nov 6, 2023
@elijah-semyonov elijah-semyonov changed the title Make skia dispose a critical section on iOS. Make Skia context usage a critical section on iOS. Nov 6, 2023
@elijah-semyonov elijah-semyonov merged commit a985c43 into jb-main Nov 6, 2023
3 checks passed
@elijah-semyonov elijah-semyonov deleted the es/skia-crash-fix branch November 6, 2023 16:17
@juhaodong
Copy link

how should we test this?

@elijah-semyonov elijah-semyonov restored the es/skia-crash-fix branch November 7, 2023 07:00
elijah-semyonov added a commit that referenced this pull request Nov 17, 2023
elijah-semyonov added a commit that referenced this pull request Nov 17, 2023
## Proposed Changes

Using Skia context in multiple threads simultaneously leads to
occasional unreproducable crashes on users' side.
Roll back experimental #896. Disable the path for encoding rendering
commands on a separate thread until the scenario is resolved and
underlying issue is fixed.

## Testing

Test: N/A

## Issues Fixed

Fixes: JetBrains/compose-multiplatform#3862
igordmn pushed a commit that referenced this pull request Nov 20, 2023
## Proposed Changes

Using Skia context in multiple threads simultaneously leads to
occasional unreproducable crashes on users' side.
Roll back experimental #896. Disable the path for encoding rendering
commands on a separate thread until the scenario is resolved and
underlying issue is fixed.

## Testing

Test: N/A

## Issues Fixed

Fixes: JetBrains/compose-multiplatform#3862
mazunin-v-jb pushed a commit that referenced this pull request Dec 7, 2023
## Proposed Changes

Since there are no reliable repros, it's a speculative fix for [the
crash](JetBrains/compose-multiplatform#3862)
on iOS.
It's based on an assumption that the case for the crash is caused by
render command encoding in a separate thread being performed after (or
in parallel) with the context disposal on the main thread which leads to
incorrect state inside Skia.

## Testing

Test: see if issues persists.

## Issues Fixed

Fixes: JetBrains/compose-multiplatform#3862

## Note
Skia is supposed to handle internal resources based on reference
counting and assumed scenario shouldn't lead to the crash, since the
context should be indirectly retained by the moment encoding starts.
Revert if issue persists because that logic would be redundant.
mazunin-v-jb pushed a commit that referenced this pull request Dec 7, 2023
## Proposed Changes

Using Skia context in multiple threads simultaneously leads to
occasional unreproducable crashes on users' side.
Roll back experimental #896. Disable the path for encoding rendering
commands on a separate thread until the scenario is resolved and
underlying issue is fixed.

## Testing

Test: N/A

## Issues Fixed

Fixes: JetBrains/compose-multiplatform#3862
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on iOS: GrGpuResource::release()
3 participants