You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Mario Schlipf (Jira)" <ji...@apache.org> on 2019/09/19 12:08:00 UTC

[jira] [Updated] (QPIDJMS-474) Race condition in JmsLocalTransactionContext.onConnectionInterrupted leading to NPE

     [ https://issues.apache.org/jira/browse/QPIDJMS-474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mario Schlipf updated QPIDJMS-474:
----------------------------------
    Description: 
Hi,

I am using qpid-cms-client version 0.39.0, but I can see that the same problem exists in the current version.

{{The function `JmsLocalTransactionContext.onConnectionInterrupted is missing a null-check for the `transactionInfo` field.}}

This function is called from `JmsSession.onConnectionInterrupted`. If `transactionInfo` is null, this leads to the fact that consumers and producers are not properly notified of the interrupted connection.

I am using qpid-jms-client in conjunction with Spring's `SingleConnectionFactory`. I can see rare cases where `transactionInfo` is null and in which the SpringConnectionFactory will not be informed about the transaction loss. In these cases, there is no automatic reconnect from Spring.

 

Below some logging when the NPE occurs:

 

 
{code:java}
2019-09-19T08:39:17,141 [WARN ] [AmqpProvider :(2):[amqps://10.0.0.12:5672]] AbstractEventExecutor - A task raised an exception. Task: org.apache.qpid.jms.provider.amqp.AmqpProvider$$Lambda$327/2054861790@467bfdd
java.lang.NullPointerException: null
        at org.apache.qpid.jms.JmsLocalTransactionContext.onConnectionInterrupted(JmsLocalTransactionContext.java:333) ~[qpid-jms-client-0.39.0.jar!/:?]
        at org.apache.qpid.jms.JmsSession.onConnectionInterrupted(JmsSession.java:1340) ~[qpid-jms-client-0.39.0.jar!/:?]
        at org.apache.qpid.jms.JmsConnection.onConnectionFailure(JmsConnection.java:1356) ~[qpid-jms-client-0.39.0.jar!/:?]
        at org.apache.qpid.jms.provider.amqp.AmqpProvider.fireProviderException(AmqpProvider.java:1069) ~[qpid-jms-client-0.39.0.jar!/:?]
        at org.apache.qpid.jms.provider.amqp.AmqpProvider.lambda$onTransportClosed$18(AmqpProvider.java:867) ~[qpid-jms-client-0.39.0.jar!/:?]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:315) ~[netty-transport-native-epoll-4.1.29.Final-linux-x86_64.jar!/:4.1.29.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
{code}
 

My suspicion is that this NPE is responsible for the exception not properly proparagated, but I am still investigating.

It would help very much if anyone from the Qpid team could validate this as well.

 

Thanks

  was:
Hi,

I am using qpid-cms-client version 0.39.0, but I can see that the same problem exists in the current version.

The function `JmsLocalTransactionContext.onConnectionInterrupted` is missing a null-check for the `transactionInfo` field.

This function is called from `JmsSession.onConnectionInterrupted`. If `transactionInfo` is null, this leads to the fact that consumers and producers are not properly notified of the interrupted connection.

I am using qpid-jms-client in conjunction with Spring's `SingleConnectionFactory`. I can see rare cases where `transactionInfo` is null and in which the SpringConnectionFactory will not be informed about the transaction loss. In these cases, there is no automatic reconnect from Spring.

 

Below some logging when the NPE occurs:

```

2019-09-19T08:39:17,141 [WARN ] [AmqpProvider :(2):[amqps://10.0.0.12:5672]] AbstractEventExecutor - A task raised an exception. Task: org.apache.qpid.jms.provider.amqp.AmqpProvider$$Lambda$327/2054861790@467bfdd

java.lang.NullPointerException: null

        at org.apache.qpid.jms.JmsLocalTransactionContext.onConnectionInterrupted(JmsLocalTransactionContext.java:333) ~[qpid-jms-client-0.39.0.jar!/:?]

        at org.apache.qpid.jms.JmsSession.onConnectionInterrupted(JmsSession.java:1340) ~[qpid-jms-client-0.39.0.jar!/:?]

        at org.apache.qpid.jms.JmsConnection.onConnectionFailure(JmsConnection.java:1356) ~[qpid-jms-client-0.39.0.jar!/:?]

        at org.apache.qpid.jms.provider.amqp.AmqpProvider.fireProviderException(AmqpProvider.java:1069) ~[qpid-jms-client-0.39.0.jar!/:?]

        at org.apache.qpid.jms.provider.amqp.AmqpProvider.lambda$onTransportClosed$18(AmqpProvider.java:867) ~[qpid-jms-client-0.39.0.jar!/:?]

        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]

        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]

        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:315) ~[netty-transport-native-epoll-4.1.29.Final-linux-x86_64.jar!/:4.1.29.Final]

        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]

        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]

```

 

My suspicion is that this NPE is responsible for the exception not properly proparagated, but I am still investigating.

It would help very much if anyone from the Qpid team could validate this as well.

 

Thanks


> Race condition in JmsLocalTransactionContext.onConnectionInterrupted leading to NPE
> -----------------------------------------------------------------------------------
>
>                 Key: QPIDJMS-474
>                 URL: https://issues.apache.org/jira/browse/QPIDJMS-474
>             Project: Qpid JMS
>          Issue Type: Bug
>          Components: qpid-jms-client
>    Affects Versions: 0.45.0
>            Reporter: Mario Schlipf
>            Priority: Major
>
> Hi,
> I am using qpid-cms-client version 0.39.0, but I can see that the same problem exists in the current version.
> {{The function `JmsLocalTransactionContext.onConnectionInterrupted is missing a null-check for the `transactionInfo` field.}}
> This function is called from `JmsSession.onConnectionInterrupted`. If `transactionInfo` is null, this leads to the fact that consumers and producers are not properly notified of the interrupted connection.
> I am using qpid-jms-client in conjunction with Spring's `SingleConnectionFactory`. I can see rare cases where `transactionInfo` is null and in which the SpringConnectionFactory will not be informed about the transaction loss. In these cases, there is no automatic reconnect from Spring.
>  
> Below some logging when the NPE occurs:
>  
>  
> {code:java}
> 2019-09-19T08:39:17,141 [WARN ] [AmqpProvider :(2):[amqps://10.0.0.12:5672]] AbstractEventExecutor - A task raised an exception. Task: org.apache.qpid.jms.provider.amqp.AmqpProvider$$Lambda$327/2054861790@467bfdd
> java.lang.NullPointerException: null
>         at org.apache.qpid.jms.JmsLocalTransactionContext.onConnectionInterrupted(JmsLocalTransactionContext.java:333) ~[qpid-jms-client-0.39.0.jar!/:?]
>         at org.apache.qpid.jms.JmsSession.onConnectionInterrupted(JmsSession.java:1340) ~[qpid-jms-client-0.39.0.jar!/:?]
>         at org.apache.qpid.jms.JmsConnection.onConnectionFailure(JmsConnection.java:1356) ~[qpid-jms-client-0.39.0.jar!/:?]
>         at org.apache.qpid.jms.provider.amqp.AmqpProvider.fireProviderException(AmqpProvider.java:1069) ~[qpid-jms-client-0.39.0.jar!/:?]
>         at org.apache.qpid.jms.provider.amqp.AmqpProvider.lambda$onTransportClosed$18(AmqpProvider.java:867) ~[qpid-jms-client-0.39.0.jar!/:?]
>         at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]
>         at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]
>         at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:315) ~[netty-transport-native-epoll-4.1.29.Final-linux-x86_64.jar!/:4.1.29.Final]
>         at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]
>         at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
> {code}
>  
> My suspicion is that this NPE is responsible for the exception not properly proparagated, but I am still investigating.
> It would help very much if anyone from the Qpid team could validate this as well.
>  
> Thanks



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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