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

Timothy A. Bish resolved PROTON-2996.
-------------------------------------
    Fix Version/s: protonj2-1.5.0
       Resolution: Fixed

> [protonj2] Connection default session is not replaced after the remote ends it
> ------------------------------------------------------------------------------
>
>                 Key: PROTON-2996
>                 URL: https://issues.apache.org/jira/browse/PROTON-2996
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: protonj2
>    Affects Versions: protonj2-1.4.0
>            Reporter: Tanishq Choudhary
>            Assignee: Timothy A. Bish
>            Priority: Major
>             Fix For: protonj2-1.5.0
>
>
> Connection.openReceiver(), openSender() and openAnonymousSender() all use the 
> connection's default session. If the remote ends that session while the 
> connection stays open, the connection can't open links through those methods 
> any more.
> ClientConnection.lazyCreateConnectionSession() only creates a session when 
> the connectionSession field is null:
> {code:java}
> private ClientSession lazyCreateConnectionSession() throws ClientException {
>     if (connectionSession == null) {
>         connectionSession = sessionBuilder.session(null).open();
>     }
>     return connectionSession;
> }
> {code}
> The field keeps the closed session, so every later call fails until the 
> application closes the connection. Reconnect doesn't help because the 
> connection itself never dropped.
> Seen with Spring AMQP 4.1.2 and protonj2 1.4.0 against RabbitMQ 4.1.3, which 
> ends the session when a receiver attaches to a missing queue 
> (amqp:not-found). Afterwards a publish on a cached anonymous sender fails 
> with ClientSessionRemotelyClosedException, and each new receiver fails with:
> {noformat}
> org.apache.qpid.protonj2.client.exceptions.ClientIllegalStateException:
>     Cannot create new Receiver from closed Session
> {noformat}
> The same failure happens with a local close, which needs no broker setup:
> {code:java}
> Connection connection = client.connect(host, port);
> connection.openReceiver("a").openFuture().get();
> connection.defaultSession().close();
> connection.openReceiver("b");  // fails, and keeps failing
> {code}
> Expected: the connection opens a new default session on the next call that 
> needs one, so applications that use the Connection-level API don't have to 
> manage sessions to survive a session ending. Links on the old session stay 
> closed, as they do today.
> Spring AMQP tracks this in 
> https://github.com/spring-projects/spring-amqp/issues/3784. Spring is adding 
> a temporary workaround that manages its own session until protonj2 handles 
> this.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to