qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xin Chen (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (QPID-5385) Create/Close session in a loop causing connection to be closed and connection.close to hang after that
Date Tue, 03 Dec 2013 19:11:35 GMT

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

Xin Chen edited comment on QPID-5385 at 12/3/13 7:11 PM:
---------------------------------------------------------

The patch contains the following changes:
1. add END_PIPE to session state. when sending an end frame, the session is not removed from
the connection session collection if in this state. It is later removed when a begin is received
from peer. This avoids the connection being closed due to unknown channel.
2. when receiving a session frame, if the channel cannot be found, close the connection and
perform a null check on the session. This avoids the null pointer exception.
3. in frame handler, close the connection on RuntimeException. This keeps the thread running
and avoids hanging of other threads waiting on the connection's lock.


was (Author: xinchen):
The patch contains the following changes:
1. add END_PIPE to session state. when sending an end frame, the session is not remote from
the connection session collection if in this state. It is later removed when a begin is received
from peer. This avoids the connection being closed due to unknown channel.
2. when receiving a session frame, if the channel cannot be found, close the connection and
perform a null check on the session. This avoids the null pointer exception.
3. in frame handler, close the connection on RuntimeException. This keeps the thread running
and avoids hanging of other threads waiting on the connection's lock.

> Create/Close session in a loop causing connection to be closed and connection.close to
hang after that
> ------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-5385
>                 URL: https://issues.apache.org/jira/browse/QPID-5385
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.24
>            Reporter: Xin Chen
>         Attachments: QPID-5385.patch
>
>
> sample test code:
>       factory = ConnectionFactoryImpl.createFromURL(connectionUri);
>       connection = factory.createConnection();
>       connection.start();
>       for (int i = 0; i < 10; i++)
>       {
>         session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 
>         session.close();
>       }
>       session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
>       Destination destination = session.createQueue("q1");
>       MessageProducer producer = session.createProducer(destination);
>       session.close();
>       connection.close();
> Issues observed:
> 1. ConnectionClosedException is thrown from connection.createSession(...)
> 2. SenderCreationException is thrown from session.createProcuder(...)
> 2. the last connection.close() can hang
> Root cause:
> connection.createSession(...) -> send a begin frame
> session.close() -> send an end frame and session is removed from connection's local
session collection
> When the peer sends back a begin frame, no session can be found using begin.remote-channel
so the connection is closed. This causes session/producer creation to fail.
> If the peer also sends another frame (e.g. flow), it generates a NullPointerException
in ConnectionEndpoint.receiveFlow() because session is null. This exception is unhandled and
the thread dies. Connection.close() hangs with the following stack:
> "main" prio=10 tid=0x00007f738400a000 nid=0x1508 in Object.wait() [0x00007f738cd20000]
>    java.lang.Thread.State: WAITING (on object monitor)
>                 at java.lang.Object.wait(Native Method)
>                 - waiting on <0x00000007d7ba3ac8> (a org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint)
>                 at java.lang.Object.wait(Object.java:503)
>                 at org.apache.qpid.amqp_1_0.client.Connection.close(Connection.java:430)
>                 - locked <0x00000007d7ba3ac8> (a org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint)
>                 at org.apache.qpid.amqp_1_0.jms.impl.ConnectionImpl.close(ConnectionImpl.java:385)



--
This message was sent by Atlassian JIRA
(v6.1#6144)

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


Mime
View raw message