Xin Chen created QPID-5385:
------------------------------
Summary: 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
sample test code:
factory = ConnectionFactoryImpl.createFromURL(connectionUri);
connection = factory.createConnection();
connection.start();
for (int i = 0; i < 10; i++)
{
System.out.println("creating session " + 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: [email protected]
For additional commands, e-mail: [email protected]