You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for working on making Okio to Kotlin Multiplatform.
I have encountered InvalidMutabilityException when testing with FakeFileSystem on Kotlin/Native.
However, it’s working with FileSystem.SYSTEM as intended.
val path ="/path/to/file".toPath()
@Test
funsuccess() = runTest { // runTest: the same as runBlocking with Dispatchers.Mainval fileSystem:FileSystem=FileSystem.SYSTEMval string = withContext(Dispatchers.Default) { fileSystem.read(path) { readUtf8() } }
println(string)
}
@Test
funfail() = runTest {
val fileSystem:FileSystem=FakeFileSystem()
val string = withContext(Dispatchers.Default) { fileSystem.read(path) { readUtf8() } }
println(string)
}
Stack trace
kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen okio.fakefilesystem.FakeFileSystem.Element.File@d5c2b1e8
at kotlin.Throwable#<init>(/Users/teamcity2/buildAgent/work/11ac87a349af04d5/runtime/src/main/kotlin/kotlin/Throwable.kt:23)
at kotlin.Exception#<init>(/Users/teamcity2/buildAgent/work/11ac87a349af04d5/runtime/src/main/kotlin/kotlin/Exceptions.kt:23)
at kotlin.RuntimeException#<init>(/Users/teamcity2/buildAgent/work/11ac87a349af04d5/runtime/src/main/kotlin/kotlin/Exceptions.kt:34)
at kotlin.native.concurrent.InvalidMutabilityException#<init>(/Users/teamcity2/buildAgent/work/11ac87a349af04d5/runtime/src/main/kotlin/kotlin/native/concurrent/Freezing.kt:22)
at <global>.ThrowInvalidMutabilityException(/Users/teamcity2/buildAgent/work/11ac87a349af04d5/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt:93)
at <global>.MutationCheck(Unknown Source)
at okio.fakefilesystem.FakeFileSystem.Element.<set-lastAccessedAt>#internal(/Users/jwilson/Projects/okio/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt:416)
at okio.fakefilesystem.FakeFileSystem.Element.access#internal(/Users/jwilson/Projects/okio/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt:442)
at okio.fakefilesystem.FakeFileSystem.open#internal(/Users/jwilson/Projects/okio/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt:315)
at okio.fakefilesystem.FakeFileSystem#openReadOnly(/Users/jwilson/Projects/okio/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt:260)
at okio.fakefilesystem.FakeFileSystem#source(/Users/jwilson/Projects/okio/okio-fakefilesystem/src/commonMain/kotlin/okio/fakefilesystem/FakeFileSystem.kt:241)
********
at kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(/Users/teamcity2/buildAgent/work/11ac87a349af04d5/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.kt:30)
at kotlinx.coroutines.DispatchedTask#run(/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/internal/DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase#processNextEvent(/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/EventLoop.common.kt:277)
at kotlinx.coroutines#runEventLoop(/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/Builders.kt:80)
at kotlinx.coroutines.WorkerCoroutineDispatcherImpl.start$lambda-0#internal(/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/Workers.kt:49)
at kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$35.invoke#internal(/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/Workers.kt:47)
at kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$35.$<bridge-UNN>invoke(/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/Workers.kt:47)
at <global>.WorkerLaunchpad(/Users/teamcity2/buildAgent/work/11ac87a349af04d5/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt:70)
at <global>._ZN6Worker19processQueueElementEb(Unknown Source)
at <global>._ZN12_GLOBAL__N_113workerRoutineEPv(Unknown Source)
at <global>._pthread_start(Unknown Source)
at <global>.thread_start(Unknown Source)
The text was updated successfully, but these errors were encountered:
We might get this fixed for us for free with the new Kotlin/Native memory model. We need to adopt some locking in our FakeFileSystem for safe concurrent use.
Hi, thanks for working on making Okio to Kotlin Multiplatform.
I have encountered
InvalidMutabilityException
when testing withFakeFileSystem
on Kotlin/Native.However, it’s working with
FileSystem.SYSTEM
as intended.Environment
1.4.32
1.4.3-native-mt
com.squareup.okio:okio-multiplatform:3.0.0-alpha.6
Test code
Stack trace
The text was updated successfully, but these errors were encountered: