qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Bares <jan.ba...@wood.cz>
Subject JMS AMQP 1.0 SocketException for rapid session/producer open and close
Date Fri, 21 Feb 2014 09:35:21 GMT

The code bellow throws SocketException with QPID 0.26 AMQP 1.0. It works fine with AMQP 0-10
client. When I add sleeps of 100ms before and after the close() calls, it works. Seems like
the close() method returns too early when background threads are still not finished. The code
is minimal to reproduce the problem.

Thanks for your time, Jan

  connection = connectionFactory.createConnection();

  // send some messages to empty queue
  for (int i = 0; i < 5; i++)
      openAndClose(connection, context);

static void openAndClose(Connection connection, Context context) throws JMSException,
        NamingException, InterruptedException {
    Session session = null;
    MessageProducer messageProducer = null;

    try {
        session = connection.createSession(false/*transacted*/, Session.AUTO_ACKNOWLEDGE);
        Topic topic = (Topic) context.lookup("ORDER_HISTORY_TOPIC");
        messageProducer = session.createProducer(topic);
    } finally {
        if (messageProducer != null)
        if (session != null)

        at org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.<init>(SessionImpl.java:93)
        at org.apache.qpid.amqp_1_0.jms.impl.ConnectionImpl.createSession(ConnectionImpl.java:169)
        at org.apache.qpid.amqp_1_0.jms.impl.ConnectionImpl.createSession(ConnectionImpl.java:149)
        at org.apache.qpid.amqp_1_0.jms.impl.ConnectionImpl.createSession(ConnectionImpl.java:36)
        at cz.baresovi.qpid.Qpid.openAndClose(Qpid.java:369)
        at cz.baresovi.qpid.Qpid.testPublisherBug(Qpid.java:101)
        at cz.baresovi.qpid.Qpid.runTests(Qpid.java:61)
        at cz.baresovi.qpid.Qpid.main(Qpid.java:56)
java.net.SocketException: Socket is closed
        at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1467)
        at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1488)
        at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:70)
        at org.apache.qpid.amqp_1_0.framing.ConnectionHandler$BytesOutputHandler.processBytes(ConnectionHandler.java:418)
        at org.apache.qpid.amqp_1_0.framing.ConnectionHandler$FrameToBytesSourceAdapter.getBytes(ConnectionHandler.java:305)
        at org.apache.qpid.amqp_1_0.framing.ConnectionHandler$SequentialBytesSource.getBytes(ConnectionHandler.java:371)
        at org.apache.qpid.amqp_1_0.framing.ConnectionHandler$BytesOutputHandler.run(ConnectionHandler.java:404)
        at java.lang.Thread.run(Thread.java:744)

Jan Bareš
Calypso Lead Developer

In association with
WOOD & Company Financial Services, a.s.
Palladium, Náměstí Republiky 1079/1a
110 00 Prague, Czech Republic
Tel. +420 222 096 111
Direct +420 222 096 457
Fax. +420 222 096 222

         WOOD & Company Financial Services, a.s. and its branches are authorized and regulated
by the CNB as Home State regulator and in Poland by the KNF, in Slovakia by the NBS and in
the UK by the FCA as Host State regulators. For further information about WOOD & Co.,
its investment services, financial instruments and associated risks, safeguard client assets
(incl. compensation schemes) and contractual relationship please see our website at www.wood.com<http://www.wood.com/>
under section Corporate Governance.
         Unless otherwise stated, this transmission is neither an offer nor the solicitation
of an offer to sell or purchase any investment. All estimates, opinions and other information
contained herein are subject to change without notice and are provided in good faith but without
legal responsibility or liability. Opinion may be personal to the author and may not reflect
the opinions of WOOD & Co. Communications from sales persons, sales traders or traders
should not be regarded as investment research and may contain opinions or trading ideas which
are different from WOOD & Co. investment research opinions.
         This e-mail and any attachments are confidential and may be privileged or otherwise
protected from disclosure. If you are not a named addressee you must not use, disclose, distribute,
copy, print or rely on this e-mail and any of its attachments. Please notify the sender that
you have received this email by mistake by replying to the email, and then delete the email
and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees
should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation
or warranty as to the absence of viruses in this e-mail or any attachments. Please note that
to ensure regulatory compliance and for the protection of our clients and business, we may
monitor and read e-mails sent to and from our server(s).

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

View raw message