Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2566

WeldAlterableContext clearAndSet() needs to clear caches

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.1.1.Final
    • 3.1.0.Final
    • None
    • None

    Description

      Implementations of clearAndSet() method from WeldAlterableContext have to invoke RequestScopedCache.invalidate(). This makes sure the ThreadLocal caches for request/session/conversation scopes are flushed.

      This isn't normally a problem if you propagate contexts into a different thread. However, if you temper with context states on the same (main) thread, you will now end up in a weird state where context storage is empty, but caches still return old references.

      This scenario is from MP Concurrency where there is no guarantee which thread will be used for execution.

      A workaround is to manually invoke RequestScopedCache.invalidate() whenever integrator deals with propagation as the method is static. Though this requires weld-core dependency.

      Attachments

        Activity

          People

            manovotn Matěj Novotný
            manovotn Matěj Novotný
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: