History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-886
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Tomasz Sztelak
Reporter: Tony Bussieres
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
XFire

XFire Client not ThreadSafe

Created: 23/Feb/07 08:30 AM   Updated: 26/Feb/07 10:57 AM
Component/s: Core
Affects Version/s: 1.2.4
Fix Version/s: 1.2.5

Time Tracking:
Not Specified

File Attachments: 1. Text File Client.java.patch (1 kb)
2. Text File LocalClientTest.patch (3 kb)

Environment:
Linux 2.6, Java 1.4.2 / Java 1.5


 Description  « Hide
I use XFire as a client. witin Mule,

The XFire Client are in a Pool (common pool) and
many threads are using thoses clients to call a service.

Sometimes (about 14 times / 60) with 2 threads this happens :

DEBUG 2007-02-22 12:57:16,520 [Test-1] org.codehaus.xfire.client.Client:
Received message to http://serveur:3003/scoperta/scopertaTest
DEBUG 2007-02-22 12:57:16,520 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: adding handler
org.codehaus.xfire.client.CorrelatorHandler@c67a88 to phase pre-dispatch
DEBUG 2007-02-22 12:57:16,520 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: adding handler
org.codehaus.xfire.soap.handler.ReadHeadersHandler@1397e5c to phase parse
DEBUG 2007-02-22 12:57:16,520 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: adding handler
org.codehaus.xfire.soap.handler.ValidateHeadersHandler@196e136 to phase
pre-invoke
DEBUG 2007-02-22 12:57:16,521 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: adding handler
org.codehaus.xfire.handler.LocateBindingHandler@9bad5a to phase dispatch
DEBUG 2007-02-22 12:57:16,521 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: adding handler
org.codehaus.xfire.soap.handler.SoapActionInHandler@91f005 to phase dispatch
DEBUG 2007-02-22 12:57:16,521 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: adding handler
org.codehaus.xfire.soap.handler.SoapBodyHandler@1250ff2 to phase dispatch
DEBUG 2007-02-22 12:57:16,521 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: Invoking phase transport
DEBUG 2007-02-22 12:57:16,521 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: Invoking phase parse
DEBUG 2007-02-22 12:57:16,521 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: Invoking handler
org.codehaus.xfire.soap.handler.ReadHeadersHandler in phase parse
DEBUG 2007-02-22 12:57:16,521 [Test-1]

org.codehaus.xfire.handler.HandlerPipeline: Invoking phase pre-dispatch
DEBUG 2007-02-22 12:57:16,521 [Test-1]
org.codehaus.xfire.handler.HandlerPipeline: Invoking handler
org.codehaus.xfire.client.CorrelatorHandler in phase pre-dispatch
DEBUG 2007-02-22 12:57:16,521 [Test-1] org.codehaus.xfire.client.Client:
Correlating context with ID 1172167036476261041791506
INFO 2007-02-22 12:57:16,521 [Test-1] org.codehaus.xfire.client.Client:
No correlated invocation was found.

Cause:

When a client is triggered : Client.onReceive(MessageContext)

It creates a pipeline,
put the handlers in the pipeline then invoke the pipeline *using
MessageContext*

HOWEVER sometimes the client triggered != the client in the context.
so the handlers added to the pipeline are not related to the good client.

Fix:
See patch in attachment

The fix does :
Get the handlers for the client in the MessageContext.
Add them to the pipeline. (not the ones from "this")



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dan Diephouse - 23/Feb/07 08:34 AM
Thanks Tony! Scheduling for 1.2.5.

Tony Bussieres - 23/Feb/07 09:26 AM
This is a proof that there is a multithreading problem in the Client.

The test starts 3 Thread that contain a Client
and does the same invoke as described in testInvoke()
Each Thread invoke 15 times the service.

If the Client patch is not applied I get the :

Feb 23, 2007 10:25:22 AM org.codehaus.xfire.client.CorrelatorHandler invoke
INFO: No correlated invocation was found.

If the patch is applied, everything goes OK


Tomasz Sztelak - 26/Feb/07 08:36 AM
Fixed in svn

Tony Bussieres - 26/Feb/07 08:48 AM
Maybe the LoadClientTest patch should be applied as well ?

Tomasz Sztelak - 26/Feb/07 08:56 AM
But a little later Probably i'll create separate junit.

Holger Hoffstätte - 26/Feb/07 09:02 AM
Tomasz, can you please comment on whether the patch actually does fix the problem with correlation when several clients are used? There is still the possibility that the bug might have been caused by Mule which used client pooling. Will correlation generally work when multiple client objects are talking to the same endpoint from different threads? If that is not the case we could also try to use the same client for every endpoint.

Tony Bussieres - 26/Feb/07 10:57 AM
Holger,

The TestCase I've attached shows the same problem without using Mule. I believe that the problem was on the Xfire side.

It's good to double check anyway

-Tony