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

Mutation attempt in new Coroutines #28

Closed
mustafaozhan opened this issue Mar 26, 2022 · 3 comments
Closed

Mutation attempt in new Coroutines #28

mustafaozhan opened this issue Mar 26, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@mustafaozhan
Copy link

I am trying to migrate to new coroutine memory model for my kotlin multiplatform project but the iOS target fails with following error:

kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlin.collections.EmptySet@338bdd0
kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlin.collections.EmptySet@338bdd0
	at kotlin.Throwable#<init>(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt:24)
	at kotlin.Exception#<init>(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:23)
	at kotlin.RuntimeException#<init>(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:34)
	at kotlin.native.concurrent.InvalidMutabilityException#<init>(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Freezing.kt:24)
	at <global>.ThrowInvalidMutabilityException(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt:109)
	at <global>.Kotlin_AtomicReference_checkIfFrozen(Unknown Source)
	at kotlin.native.concurrent.AtomicReference#<init>(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Atomics.kt:237)
	at io.mockative.concurrency.AtomicReference#<init>(/Users/runner/work/mockative/mockative/mockative/src/nativeMain/kotlin/io/mockative/concurrency/AtomicReference.kt:7)
	at io.mockative.concurrency.AtomicRef#<init>(/Users/runner/work/mockative/mockative/mockative/src/commonMain/kotlin/io/mockative/concurrency/Atomic.kt:6)
	at io.mockative.concurrency.AtomicSet#<init>(/Users/runner/work/mockative/mockative/mockative/src/commonMain/kotlin/io/mockative/concurrency/AtomicSet.kt:8)
	at io.mockative.Mockable#<init>(/Users/runner/work/mockative/mockative/mockative/src/commonMain/kotlin/io/mockative/Mockable.kt:13)
	at com.oztechan.ccc.common.settings.SettingsRepositoryMock#<init>(/Users/mustafa.ozhan/Projects/Personal/CurrencyConverterCalculator/CCC/client/build/generated/ksp/ios/iosTest/kotlin/com/oztechan/ccc/common/settings/SettingsRepositoryMock.kt:19)
	at io.mockative#mock(/Users/mustafa.ozhan/Projects/Personal/CurrencyConverterCalculator/CCC/client/build/generated/ksp/ios/iosTest/kotlin/io/mockative/GeneratedMocks.kt:4)
	at com.oztechan.ccc.client.viewmodel.SettingsViewModelTest#<init>(/Users/mustafa.ozhan/Projects/Personal/CurrencyConverterCalculator/CCC/client/src/commonTest/kotlin/com/oztechan/ccc/client/viewmodel/SettingsViewModelTest.kt:45)
	at com.oztechan.ccc.client.viewmodel.$SettingsViewModelTest$test$0.createInstance#internal(/Users/mustafa.ozhan/Projects/Personal/CurrencyConverterCalculator/CCC/client/src/commonTest/kotlin/com/oztechan/ccc/client/viewmodel/SettingsViewModelTest.kt:41)
	at kotlin.native.internal.test.BaseClassSuite.TestCase#run(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestSuite.kt:82)
	at kotlin.native.internal.test.TestRunner.run#internal(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestRunner.kt:245)
	at kotlin.native.internal.test.TestRunner.runIteration#internal(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestRunner.kt:271)
	at kotlin.native.internal.test.TestRunner#run(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestRunner.kt:286)
	at kotlin.native.internal.test#testLauncherEntryPoint(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/Launcher.kt:30)
	at kotlin.native.internal.test#main(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/Launcher.kt:34)
	at <global>.Konan_start(/Users/teamcity1/teamcity_work/6326934d18cfe24e/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/Launcher.kt:33)
	at <global>.Init_and_run_start(Unknown Source)
	at <global>.start_sim(Unknown Source)
	at <global>.0x0(Unknown Source)

Related PR: Oztechan/CCC#567

@Nillerr
Copy link
Collaborator

Nillerr commented May 14, 2022

Hi @mustafaozhan

I have just released version 1.2.0 of Mockative (it might be 20-30 minutes until it's available on Maven Central), in which I tested it with the new memory manager without being able to replicate your issue. Would you mind checking whether the issue remains in this version?

@Nillerr Nillerr added the bug Something isn't working label May 14, 2022
@Nillerr
Copy link
Collaborator

Nillerr commented May 14, 2022

Hi again

I discovered an issue in 1.2.0 causing the generated code to be invalid. I have resolved this issue in 1.2.1, which is on its way out.

@mustafaozhan
Copy link
Author

@Nillerr thanks a lot 🙂 I confirm that this issue is fixed with 1.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants