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

WeldAlterableContext clearAndSet() needs to clear caches

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.1.0.Final
    • Fix Version/s: 3.1.1.Final
    • Component/s: None
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: