Uploaded image for project: 'Agroal'
  1. Agroal
  2. AG-177

LocalConnectionCache issue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 1.12
    • api
    • None
    • False
    • False
    • Hide

      Try to get connection to 'db-1' from 'Thread-1'. After that it will cache it in ThreadLocal and return it to client code.

       

      Try to get connection to 'db-2' from 'Thread-1'. After that it will get foreign 'db-1' from local cache. Client code will use completely different database to process the request.

       

       

      Show
      Try to get connection to 'db-1' from 'Thread-1'. After that it will cache it in ThreadLocal and return it to client code.   Try to get connection to 'db-2' from 'Thread-1'. After that it will get foreign 'db-1' from local cache. Client code will use completely different database to process the request.    

      Good afternoon.

      It seems to me that there is one misconfiguration in the default configuration value of the local cache field. Right now it has the following value – LocalConnectionCache.single()

      However, in the general case this local cache leads to undefined behavior. Our application uses several DataSources. Even if you will use pool per DataSource you can face an issue when foreign DataSource object will be used for execution.

      Consider to reimplement LocalCache or disable it for default configuration supplier.

       

              lbarreiro-1 Luis Barreiro
              flupec Vasily Avtaev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: