Conversation
dpad85
approved these changes
Apr 12, 2024
Member
dpad85
left a comment
There was a problem hiding this comment.
The end result is that multiple instances of getPayment are running simultaneously on different background threads, our built-in Cache is getting corrupted, and the linked-list ends up with cycles leading to infinite loops in certain situations.
It's relatively easy to solve this one particular bug. But the bigger issue is that I don't know what other issues this problem might cause. And time is needed to further research the issue.
Makes sense, the SyncTxManager could be another cause, and there may be others. Will make a build ASAP.
This was referenced Apr 12, 2024
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.
We were experiencing app freezes in production. The root cause of the problem was Touchlab's SKIE. In particular, an unexpected quirk of the SKIE implementation.
Consider this Swift code:
Here we're calling a
suspendfunction in Kotlin (getPayment) from Swift. Now it has always been the case this must be done on the main thread (e.g.MainActor). In fact if you tried from a background thread, Kotlin would throw an exception. It has also been the case thatgetPaymentexecutes on the main thread.In recent versions of Kotlin, this main-thread restriction could be removed with a flag.
It appears that SKIE automatically sets this flag. From their docs
The end result is that multiple instances of
getPaymentare running simultaneously on different background threads, our built-in Cache is getting corrupted, and the linked-list ends up with cycles leading to infinite loops in certain situations.It's relatively easy to solve this one particular bug. But the bigger issue is that I don't know what other issues this problem might cause. And time is needed to further research the issue.