cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Iacopo Rozzo (JIRA)" <>
Subject [jira] [Updated] (CXF-6782) Modifications to JAX-WS client request context leak the thread scope
Date Wed, 17 Feb 2016 15:09:18 GMT


Iacopo Rozzo updated CXF-6782:
    Attachment: CXF-6782_reproducer.tar.gz

Contains a Maven project with a unit test to reproduce the issue.
tar xzvf CXF-6782_reproducer.tar.gz
cd CXF-6782_reproducer
mvn test

> Modifications to JAX-WS client request context leak the thread scope
> --------------------------------------------------------------------
>                 Key: CXF-6782
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.0.7
>         Environment: java version "1.7.0_80"
>            Reporter: Iacopo Rozzo
>         Attachments: CXF-6782_reproducer.tar.gz
> As documented in [this|]
page the request context can be made thread local (??Thus, anything set there will affect
requests on other threads.??), but
> I observed that even after having set the property _thread.local.request.context_ it
arrives sometimes that some modifications to the request context leak the thread scope, leading
potentially to unpredictable behaviors.
> Digging in the code I found that the reason is the following.
> The class _org.apache.cxf.endpoint.ClientImpl_ stores the request context entries in
a map called _currentRequestContext_. After property _thread.local.request.context_ is set
to true a call to _getRequestContext()_ triggers the creation of another map of type _org.apache.cxf.endpoint.ClientImpl.EchoContext_
which is associated to the current thread (the mapping is kept in the _requestContext_ map).
This should guarantee the per thread isolation.
> The _EchoContext_ is initialized with the entries of the shared map, and as its name
suggests modifications are echoed back to the shared map. The problem is that when accessing
the request context for the first time in a thread all the modifications done on other threads
do affect the current thread even after "thread.local.request.context" is set to true, due
to the initialization of the thread local map with shared one.

This message was sent by Atlassian JIRA

View raw message