Freezing issue
See original GitHub issueI’m trying to track down a freezing issue on iOS when using reaktive streams, and pared down the issue with a new sample project.
It seems the call to mutate() below is causing ShimTester to be frozen, but I thought using threadLocal would prevent that. Is my current usage correct? What’s the correct way to call mutate() in the example below?
KN code:
class ShimTester {
init {
expectEnsureNeverFrozenShim()
}
fun mutate() { }
fun testApiWrapper(): ObservableWrapper<Unit> {
return testApi()
.subscribeOn(mainScheduler)
.observeOn(mainScheduler)
.threadLocal()
.wrap()
}
fun testApi(): Observable<Unit> {
return observableFromFunction {
mutate()
Unit
}
}
}
On iOS, I’m using:
ShimTester().testApiWrapper().subscribe(
isThreadLocal: true,
onSubscribe: nil,
onError: nil,
onComplete: nil) { unit in
print("Done")
}
This causes an exception:
Uncaught exception: kotlin.native.concurrent.FreezingException:
freezing of [com.badoo.reaktive.scheduler.MainScheduler.ExecutorImpl.Operation@1e25bc8] has failed,
first blocker is ...ShimTester@1daa928kotlin.native.concurrent.FreezingException:
freezing of [com.badoo.reaktive.scheduler.MainScheduler.ExecutorImpl.Operation@1e25bc8] has failed,
first blocker is ..ShimTester@1daa928
I tried moving threadLocal further upstream, before mutate(), but hit the same freeze exception:
class ShimTester {
...
fun testApi(): Observable<Unit> {
return observableOf(5)
.subscribeOn(mainScheduler)
.observeOn(mainScheduler)
.threadLocal()
.map {
mutate()
Unit
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:22 (12 by maintainers)
Top Results From Across the Web
How To Fix Computer Freezing - Driver Easy
Fixes for computer freezing · Update your drivers · Adjust power plan settings for your hard disk · Delete the temp files ·...
Read more >6 Methods to Solve Computer Keeps Freezing (#5 Is Awesome)
Computer keeps freezing? This page tells you how to effectively fix the Windows keeps freezing issue with ease.
Read more >Windows-based computer freeze troubleshooting
This article describes how to troubleshoot freeze issues on Windows-based computers and servers. It also provides methods for collecting ...
Read more >Fix an Android device that freezes or won't respond
Try the following steps if your phone: Freezes Stops responding Is stuck with the screen on After each step, restart your phone to...
Read more >Tips for Random System Freezing Issue - Intel
Provides useful tips to try with Random System Freezing Issue. ... Motherboard issues: If possible, swap with a good working motherboard.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey, it’s hard to understand why is it frozen, the fix may help. It may be frozen by Reaktive or by SQLDelight. But in general I would not expect the listener to be not frozen, and just design the app in such a way. You can try querying database in the following way:
Or like this:
You can find some useful SQLDelight extensions here.
Please note, I did not try yet the provided code above in Kotlin/Native. But it should work assuming SQLDelight is freezable (unlike Ktor). I hope it is freezable.
Actually there is a bug. The following code should work but it crashes in iOS:
I will fix this. Thanks for raising the issue!