activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Beránek (Created) (JIRA) <j...@apache.org>
Subject [jira] [Created] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection
Date Tue, 18 Oct 2011 08:14:10 GMT
Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks
Connection
------------------------------------------------------------------------------------------------------

                 Key: AMQ-3547
                 URL: https://issues.apache.org/jira/browse/AMQ-3547
             Project: ActiveMQ
          Issue Type: Bug
          Components: JMS client
    Affects Versions: 5.5.0
            Reporter: Martin Beránek
            Priority: Critical


Similar to https://issues.apache.org/jira/browse/AMQ-3529

call close() method on connection raise JMSException with InterruptedIOException as cause

Sample program:

public static void main(String[] args) throws Exception {
	ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
	Connection connection = connectionFactory.createConnection();
	Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
	final Thread mainThread = Thread.currentThread();
	new Thread() {

		public void run() {
			// this thread interrupt main thread after 3s
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
			}
			mainThread.interrupt();
		};
	}.start();

	try {
		//wait for interrupt
		Thread.sleep(10000);
	} catch (InterruptedException e) {
		Thread.currentThread().interrupt();
	}

	try {
		// this generate exception - bug???
		connection.close();
	} catch (JMSException e) {
		e.printStackTrace();
	}
	// non-daemon thread responsible for connection still running, program
	// will not terminate
}


when I remove line with Session obtain, everything works OK

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message