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
{{ message }}
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.
Hello,
I'm not sure if the library is supposed to be thread safe, but I'm having an issue when accessing the database from multiple threads.
In particular, the problem seems to be in this section of the library:
class OfField(override val member: Field) : ValueGetter() {
override fun get(model: Any): Any? {
@Suppress("DEPRECATION") val wasAccessible = member.isAccessible
if (!wasAccessible) member.isAccessible = true
try {
return member.get(model)
} finally {
if (!wasAccessible) member.isAccessible = false
}
}
}
Here the access is not protected by a mutex, so it happens that a Thread tries to get the member while isAccessible has been set to false by another Thread
The text was updated successfully, but these errors were encountered:
java.lang.IllegalAccessException: class org.kodein.db.impl.model.jvm.AnnotationMetadataExtractor$ValueGetter$OfField cannot access a member of class xxxxxx.DeviceFaultData with modifiers "private final"
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Unknown Source)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(Unknown Source)
at java.base/java.lang.reflect.Field.checkAccess(Unknown Source)
at java.base/java.lang.reflect.Field.get(Unknown Source)
at org.kodein.db.impl.model.jvm.AnnotationMetadataExtractor$ValueGetter$OfField.get(AnnotationMetadataExtractor.kt:34)
at org.kodein.db.impl.model.jvm.AnnotationMetadataExtractor.extractMetadata(AnnotationMetadataExtractor.kt:110)
at org.kodein.db.impl.model.ModelDBImpl.getMetadata$kodein_db(ModelDBImpl.kt:72)
at org.kodein.db.impl.model.ModelWriteModule$DefaultImpls.put(ModelWriteModule.kt:30)
at org.kodein.db.impl.model.ModelWriteModule$DefaultImpls.put(ModelWriteModule.kt:62)
at org.kodein.db.impl.model.ModelDBImpl.put(ModelDBImpl.kt:19)
at org.kodein.db.impl.model.ModelDBImpl.put(ModelDBImpl.kt:84)
at org.kodein.db.impl.model.cache.CachedModelDB.put(CachedModelDB.kt:24)
at org.kodein.db.impl.DBImpl.put(DBImpl.kt:16)
at org.kodein.db.DB$DefaultImpls.put(DB.kt:13)
at org.kodein.db.impl.DBImpl.put(DBImpl.kt:13)
at org.kodein.db.DBWrite$DefaultImpls.put(DBWrite.kt:6)
at org.kodein.db.DB$DefaultImpls.put(DB.kt:11)
at org.kodein.db.impl.DBImpl.put(DBImpl.kt:13)
at xxxxx.DeviceRepository.saveDeviceFaultData(DeviceRepository.kt:86)
at xxxxx.FaultsTask.checkDevice(FaultsTask.kt:47)
at xxxxx.FaultsTask.run$lambda-0(FaultsTask.kt:29)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Hello,
I'm not sure if the library is supposed to be thread safe, but I'm having an issue when accessing the database from multiple threads.
In particular, the problem seems to be in this section of the library:
Here the access is not protected by a mutex, so it happens that a Thread tries to get the member while isAccessible has been set to false by another Thread
The text was updated successfully, but these errors were encountered: