You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Martin Beránek (Created JIRA)" <ji...@apache.org> on 2011/10/18 10:14:10 UTC

[jira] [Created] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

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

       

[jira] [Assigned] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Timothy Bish (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish reassigned AMQ-3547:
---------------------------------

    Assignee: Timothy Bish
    
> 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
>            Assignee: Timothy Bish
>            Priority: Critical
>         Attachments: AMQ3529Test.java, AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Commented] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Timothy Bish (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13137520#comment-13137520 ] 

Timothy Bish commented on AMQ-3547:
-----------------------------------

The fix looks to be fairly trivial, if you can update your test attachment with the license grant we should be able to get this in a 5.6 release.
                
> 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
>            Assignee: Timothy Bish
>            Priority: Critical
>         Attachments: AMQ3529Test.java, AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Updated] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Timothy Bish (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish updated AMQ-3547:
------------------------------

    Attachment: AMQ3529Test.java
    
> 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
>         Attachments: AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Updated] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Martin Beránek (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Beránek updated AMQ-3547:
--------------------------------

    Attachment: AMQ3529Test.java

I have to reupload junit test bacause of license.
                
> 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
>            Assignee: Timothy Bish
>            Priority: Critical
>         Attachments: AMQ3529Test.java, AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Reopened] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Martin Beránek (Reopened JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Beránek reopened AMQ-3547:
---------------------------------


new junit test that correctly simulate problem
                
> 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
>         Attachments: AMQ3529Test.java, AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Updated] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Martin Beránek (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Beránek updated AMQ-3547:
--------------------------------

    Attachment:     (was: AMQ3529Test.java)
    
> 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
>            Assignee: Timothy Bish
>            Priority: Critical
>         Attachments: AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Commented] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Gary Tully (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13137147#comment-13137147 ] 

Gary Tully commented on AMQ-3547:
---------------------------------

@Martin, you need to tick the license grant option on that latest test attachment.
                
> 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
>         Attachments: AMQ3529Test.java, AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Closed] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Timothy Bish (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish closed AMQ-3547.
-----------------------------

    Resolution: Cannot Reproduce

Could not reproduce this with supplied code, if you can make the attached JUnit test case reproduce this behavior please reopen and attach the new test.
                
> 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
>         Attachments: AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Updated] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Philippe Mouawad (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philippe Mouawad updated AMQ-3547:
----------------------------------

    Comment: was deleted

(was: Hello,
I tested last nightly build that integrates this fix, issue is not fixed for me.

Regards
Philippe)
    
> 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
>            Assignee: Timothy Bish
>            Priority: Critical
>             Fix For: 5.6.0
>
>         Attachments: AMQ3529Test.java, AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Resolved] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Timothy Bish (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQ-3547.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 5.6.0

Fix applied in trunk, thanks for getting the test going.
                
> 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
>            Assignee: Timothy Bish
>            Priority: Critical
>             Fix For: 5.6.0
>
>         Attachments: AMQ3529Test.java, AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Commented] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Timothy Bish (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13129785#comment-13129785 ] 

Timothy Bish commented on AMQ-3547:
-----------------------------------

Attached a unit test based on your sample code.  No exceptions or errors are seen when run against trunk.
                
> 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
>         Attachments: AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Updated] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Martin Beránek (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Beránek updated AMQ-3547:
--------------------------------

    Description: 
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 1s
			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

  was:
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

    
> 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 1s
> 			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

       

[jira] [Updated] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Martin Beránek (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Beránek updated AMQ-3547:
--------------------------------

    Attachment: AMQ3529Test.java

corrected test
                
> 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
>         Attachments: AMQ3529Test.java, AMQ3529Test.java
>
>
> 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 1s
> 			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

       

[jira] [Commented] (AMQ-3547) Calling Connection.close() on interrupted thread generates InterruptedIOException and leaks Connection

Posted by "Philippe Mouawad (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13139562#comment-13139562 ] 

Philippe Mouawad commented on AMQ-3547:
---------------------------------------

Hello,
I tested last nightly build that integrates this fix, issue is not fixed for me.

Regards
Philippe
                
> 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
>            Assignee: Timothy Bish
>            Priority: Critical
>             Fix For: 5.6.0
>
>         Attachments: AMQ3529Test.java, AMQ3529Test.java
>
>
> 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 1s
> 			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