Threading issue in CommonsHTTPTransportSender when different messages use
different HTTP versions or transfer encoding settings
-------------------------------------------------------------------------------------------------------------------------------
Key: AXIS2-4716
URL: https://issues.apache.org/jira/browse/AXIS2-4716
Project: Axis2
Issue Type: Bug
Components: transports
Affects Versions: nightly
Reporter: Dave Bryant
There is a threading issue in the
CommonsHTTPTransportSender.writeMessageWithCommons() method where it determines
what HTTP version to use when sending the message and whether the chunked
transfer encoding should be used. The 'chunked' and 'httpVersion' member
variables are set when this transport sender is constructed, but are then
overridden as every message is sent if that message defines a property
explicitly enabling the chunked encoding, or setting the HTTP version.
However, as multiple threads may be active in this code simultaneously, it is
very possible that the wrong combination of parameters will be used for a
particular message. In addition, as soon as one message sets these values
explicitly, the default values are changed for all subsequent messages.
In the current trunk (r919960) from line 392:
{code}
if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) {
chunked = JavaUtils.isTrueExplicitly(messageContext
.getProperty(HTTPConstants.CHUNKED));
}
if (messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION)
!= null) {
httpVersion = (String) messageContext
.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION);
}
// Following order needed to be preserved because,
// HTTP/1.0 does not support chunk encoding
sender.setChunked(chunked);
sender.setHttpVersion(httpVersion);
sender.setFormat(format);
{code}
This should be changed to use local variables for the http version and chunked
encoding value, and retrieve this either from the message property or from the
member variables if the message property is not set. The member variables for
these settings should be regarded as immutable after init() has been called.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]