[ https://issues.apache.org/jira/browse/CXF-6609?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Colm O hEigeartaigh closed CXF-6609. ------------------------------------ > Data Race in org/apache/cxf/transport/http/HTTPConduit.prepare > --------------------------------------------------------------- > > Key: CXF-6609 > URL: https://issues.apache.org/jira/browse/CXF-6609 > Project: CXF > Issue Type: Bug > Components: Transports > Affects Versions: 3.1.2 > Environment: windows jdk 1.8 > Reporter: Thomas Krieger > Assignee: Sergey Beryozkin > Priority: Minor > Fix For: 3.1.3, 2.7.18, 3.0.7 > > > When using the demo.hw.server.HelloWorld client from different threads a data > race occurs in org/apache/cxf/transport/http/HTTPConduit.prepare: > if (this.authSupplier == null) { > this.authSupplier = > createAuthSupplier(effectiveAuthPolicy.getAuthorizationType()); > } > I would suggest to make the field authSupplier volatile. > Here is my Test client: > public class TestCxfClient extends MultiThreadedOneInstanceTemplate { > > private static final QName SERVICE_NAME > = new QName("http://server.hw.demo/", "HelloWorld"); > private static final QName PORT_NAME > = new QName("http://server.hw.demo/", "HelloWorldPort"); > private final HelloWorld hw; > > > > > public TestCxfClient(HelloWorld hw) { > super(); > this.hw = hw; > } > public void exec() > { > System.out.println(hw.sayHi("World")); > > > } > > > > public static void main(String[] args) throws Exception { > Service service = Service.create(SERVICE_NAME); > // Endpoint Address > String endpointAddress = > "http://localhost:8080/java_first_jaxws/services/hello_world"; > // If web service deployed on Tomcat (either standalone or > embedded) > // as described in sample README, endpoint should be changed to: > // String endpointAddress = > "http://localhost:8080/java_first_jaxws/services/hello_world"; > // Add a port to the Service > service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, > endpointAddress); > > HelloWorld hw = service.getPort(HelloWorld.class); > > (new TestCxfClient(hw)).test(); > } > } > public abstract class MultiThreadedOneInstanceTemplate implements Runnable { > private final AtomicInteger threadCount = new AtomicInteger(); > public void test() throws Exception > { > for(int i = 0; i < 2 ;i++) > { > Thread thread = new Thread(this, "Thread " + i); > this.threadCount.incrementAndGet(); > thread.start(); > } > while( this.threadCount.get() > 0 ) > { > Thread.sleep(1000); > } > Thread.sleep(10 * 1000); > } > public void run() > { > exec(); > threadCount.decrementAndGet(); > } > protected abstract void exec(); > } > Data Race was found by http://vmlens.com -- This message was sent by Atlassian JIRA (v6.3.4#6332)