You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Todor Mazgalov (JIRA)" <ji...@apache.org> on 2015/05/15 16:41:00 UTC
[jira] [Updated] (RAMPART-427) First requests to secured service
are failing with "The CLIENT_SIDE parameter is already locked and the value
cannot be overridden" error in multi-thread execution.
[ https://issues.apache.org/jira/browse/RAMPART-427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Todor Mazgalov updated RAMPART-427:
-----------------------------------
Summary: First requests to secured service are failing with "The CLIENT_SIDE parameter is already locked and the value cannot be overridden" error in multi-thread execution. (was: First requests to RampartMessageData are failing with "The CLIENT_SIDE parameter is already locked and the value cannot be overridden" error in multi-thread execution.)
> First requests to secured service are failing with "The CLIENT_SIDE parameter is already locked and the value cannot be overridden" error in multi-thread execution.
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: RAMPART-427
> URL: https://issues.apache.org/jira/browse/RAMPART-427
> Project: Rampart
> Issue Type: Bug
> Components: rampart-core
> Reporter: Todor Mazgalov
> Attachments: rampart-core-add-synchronization-for-CLIENT_SIDE-parameter.patch, rampart-integration-test-testMultiThreadServiceCall.patch
>
>
> First requests to the RampartMessageData in multi-thread execution are failing with error for already locked parameter. This occurs when more than one thread is trying to set CLIENT_SIDE param to the service, the first thread locks the parameter during the addition and the rest cannot override it because it's already locked. I'm providing a patch with test which proves that when threads are more than one a race condition is available during the execution and due to this condition the defect is hard to be reproduced every time. In practise it is failing about 3-4 times for 100 runs (based onto my machine).
> {quote}
> {{monospaced}}
> org.apache.axis2.AxisFault: Error in extracting message properties
> at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:76)
> at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:335)
> at org.apache.axis2.engine.Phase.invoke(Phase.java:308)
> at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:250)
> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:415)
> at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399)
> at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
> at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
> at org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:453)
> at org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:434)
> at org.apache.rampart.RampartTest$1.run(RampartTest.java:347)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:744)
> Caused by: org.apache.rampart.RampartException: Error in extracting message properties
> at org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:381)
> at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:61)
> at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
> ... 13 more
> Caused by: org.apache.axis2.AxisFault: The CLIENT_SIDE parameter is already locked and the value cannot be overridden.
> at org.apache.axis2.description.AxisDescription.addParameter(AxisDescription.java:104)
> at org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:197)
> ... 15 more
> org.apache.axis2.AxisFault: Error in extracting message properties
> at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:76)
> at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:335)
> at org.apache.axis2.engine.Phase.invoke(Phase.java:308)
> at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:250)
> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:415)
> at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399)
> at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
> at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
> at org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:453)
> at org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:434)
> at org.apache.rampart.RampartTest$1.run(RampartTest.java:347)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:744)
> Caused by: org.apache.rampart.RampartException: Error in extracting message properties
> at org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:381)
> at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:61)
> at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
> ... 13 more
> Caused by: org.apache.axis2.AxisFault: The CLIENT_SIDE parameter is already locked and the value cannot be overridden.
> at org.apache.axis2.description.AxisDescription.addParameter(AxisDescription.java:104)
> at org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:197)
> ... 15 more
> {{monospaced}}
> {quote}
> One possible solution is to be used some synchronization mechanism when the parameter is being locked, I'm attaching a patch which uses "synchronized" block by static object (I suppose that an another synchronization mechanism also can be used). I am not sure whether this parameter really should be set per service and if it is not then a synchronization will not be need because the parameter will not be created for every call but this can be answered in the best way by the Rampart developers.
> rampart-core
> org.apache.rampart.RampartMessageData.java
> {code}
> ...
> if (axisService != null && axisService.getParameter(PARAM_CLIENT_SIDE) != null) {
> this.isInitiator = true; //<---- After the addition of the parameter the rest of the threads enter here
> } else {
> this.isInitiator = !msgCtx.isServerSide();
> // TODO if Axis Service is null at this point, do we have to
> // create a dummy one ??
> if (this.isInitiator && axisService != null) {
> Parameter clientSideParam = new Parameter(); //<---- Two or more threads enter here because the parameter is not still set
> clientSideParam.setName(PARAM_CLIENT_SIDE);
> clientSideParam.setLocked(true); //<---- Parameter is being locked
> msgCtx.getAxisService().addParameter(clientSideParam); //<---- Threads are trying to add the parameter more than once and an exception is generated
> }
> }
> ...
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org