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 "Thorsten Schöning (JIRA)" <ji...@apache.org> on 2019/01/17 19:12:00 UTC

[jira] [Commented] (AXIS2-5775) upgrading from axis2 1.4 to 1.6.4

    [ https://issues.apache.org/jira/browse/AXIS2-5775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16745404#comment-16745404 ] 

Thorsten Schöning commented on AXIS2-5775:
------------------------------------------

Couldn't upgrade Axis 2 yet and thought giving it a try to find the root cause of this, maybe I'm doing something wrong and could fix this. Here's what I've found so far:

For some reason this problem always only occurs with "invokeRobust", I have no case where it occurred with "invokeBlocking". Additionally, in my case I'm configuring some HTTP connection manager within the configuration context provided by the service client and that configuration does call "ConfigurationContext.getProperty" in the end, which leads to a call to "AbstractContext.needPropertyDifferences" in theory as well. Exactly that call is the one failing later because of a missing "AxisConfiguration" most likely. OTOH, during creation of an instance of "ServiceClient", that client is configured assuming an "AxisConfiguration" to be available always and that never fails with a NPE. So, for some reason whenever a response is received and Axis tries to manage some internal state, "AxisConfiguration" seems to be missing.

{code}
        if (statusCode == HttpStatus.SC_OK) {
            // Save the HttpMethod so that we can release the connection when cleaning up
270         msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
            processResponse(method, msgContext);
        } else if (statusCode == HttpStatus.SC_ACCEPTED) {
{code}

https://github.com/apache/axis2-java/blob/v1.6.2/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java#L270

I have the feeling that for some reason there are different "ConfigurationContext" in use or "terminate" has been called already. That is nulling "AxisConfiguration" by purpose:

{code}
        if (axisConfiguration != null) {
            axisConfiguration.cleanup();
            cleanupTemp();
            this.axisConfiguration = null;
        }
{code}

https://github.com/apache/axis2-java/blob/v1.6.2/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java#L774

But I didn't find an obvious caller of that method in my context. Additionally, it can not be that simple, because the problem doesn't happen always. Instead I have the feeling it has to do with multiple threads somehow. I'm using those wherever the problems occurs, but I'm not sharing clients by those threads and instead creating individual instances per thread always.

I've found that the "MessageContext" is thread-local, so it might be that some "ConfigurationContext" is reused by different threads successively and maybe garbage collection of Java is calling "ConfigurationContext.terminate" at some point, because it is called by "ServiceClient.cleanup", which is called by "ServiceClient.finalize". I currently don't call "cleanup" on my own.

{code}
    protected void finalize() throws Throwable {
        try {
            cleanup();
        } finally {
            super.finalize();
        }
    }
{code}

https://github.com/apache/axis2-java/blob/v1.6.2/modules/kernel/src/org/apache/axis2/client/ServiceClient.java#L803

{code}
       } else {
            configContext.terminate();
        }
{code}

https://github.com/apache/axis2-java/blob/v1.6.2/modules/kernel/src/org/apache/axis2/client/ServiceClient.java#L827

> upgrading from axis2 1.4 to 1.6.4
> ---------------------------------
>
>                 Key: AXIS2-5775
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5775
>             Project: Axis2
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.6.4
>            Reporter: Rajesh
>            Priority: Major
>
> Hi All,
> This is related to existing JIRA AXIS2-5774.
> We are upgrading from axis2 1.4 to 1.6.4. We upgraded successfully and got response from provider with execute() method.
> After 4 to 8 request , the service is throwing below error intemittently.
> (Modified now)
> Error:
> =======================
> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:423)
> 	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
> 	at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
> 	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) 
> =========================
> So we added few logging to Kernel 1.6.4 and found that after few request Cleanup() method in the serviceclient is cleaning the AxisConfiguration,hence the following request getting failed with Null error.
> Also we see changes in AxisCOnfiguration in 1.4 and 1.6.4 in Cleanup method().
> Is this the normal behaviour in axis2 1.6.4?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org