Skip to content
This repository was archived by the owner on Jun 22, 2022. It is now read-only.

Exception when accessing from multiple Threads #47

@PaoloConte

Description

@PaoloConte

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions