From dev-return-8038-apmail-activemq-dev-archive=activemq.apache.org@activemq.apache.org Thu Sep 06 13:51:44 2007 Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 31390 invoked from network); 6 Sep 2007 13:51:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Sep 2007 13:51:43 -0000 Received: (qmail 12109 invoked by uid 500); 6 Sep 2007 13:51:37 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 12086 invoked by uid 500); 6 Sep 2007 13:51:37 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 12077 invoked by uid 99); 6 Sep 2007 13:51:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2007 06:51:37 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2007 13:51:42 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 572C37141F2 for ; Thu, 6 Sep 2007 06:51:22 -0700 (PDT) Message-ID: <11300123.1189086682354.JavaMail.jira@brutus> Date: Thu, 6 Sep 2007 06:51:22 -0700 (PDT) From: "Timothy Bish (JIRA)" To: dev@activemq.apache.org Subject: [jira] Updated: (AMQCPP-142) BufferedOutputStream flush called after BufferedOutputStream close resulting in unhandled exceptions In-Reply-To: <20337040.1189069942183.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQCPP-142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Timothy Bish updated AMQCPP-142: -------------------------------- Component/s: (was: CMS Impl) Openwire Fix Version/s: 2.2 Assignee: Timothy Bish (was: Nathan Mittler) > BufferedOutputStream flush called after BufferedOutputStream close resulting in unhandled exceptions > ---------------------------------------------------------------------------------------------------- > > Key: AMQCPP-142 > URL: https://issues.apache.org/activemq/browse/AMQCPP-142 > Project: ActiveMQ C++ Client > Issue Type: Bug > Components: Openwire > Affects Versions: 2.1 > Environment: WinXP Pro SP2 > Reporter: Roger > Assignee: Timothy Bish > Fix For: 2.2 > > > After comms have been broken (shutting down the broker is an easy way to reproduce...) and the producer attempts to send a message a Transport IO exception is raised but after this point the session cannot be cleanly closed. The sessions closed flag indicates it is not already closed. The problem seems to be mainly in the BufferedOutputStream - this objects "close" method is called but after this the same objects "flush" method is called resulting in exceptions (attempts to access deleted memory). I'm presuming it is attempting to send cached data after the stream has been closed. > This is ActiveMQ-CPP 2.1, using Broker version 5.0:- > http://people.apache.org/repo/m2-snapshot-repository/org/apache/activemq/apache-activemq/5.0-SNAPSHOT/apache-activemq-5.0-20070904.133257-1.zip > The following is an example snippet of code which demonstrates this problem: > static Connection* connection = NULL; > static Session* session = NULL; > static Destination* destination = NULL; > static MessageProducer* producer = NULL; > static const std::string brokerURI = "tcp://127.0.0.1:61616?wireFormat=openwire&transport.useAsyncSend=true&connectionTimeout=5000&soTimeout=1000"; > bool initialise() > { > bool result = false; > try { > ActiveMQConnectionFactory* connectionFactory = new ActiveMQConnectionFactory( brokerURI ); > // Create a Connection > connection = connectionFactory->createConnection(); > connection->start(); > delete connectionFactory; > // Create a Session > session = connection->createSession( Session::AUTO_ACKNOWLEDGE ); > // Create the destination > destination = session->createQueue( "BARNEY" ); > // Create a MessageProducer from the Session to the Queue > producer = session->createProducer( destination ); > producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT); > result = true; > } > catch (activemq::exceptions::ActiveMQException& e) { > e.printStackTrace(); > } > return result; > } > bool sendMessage(string msg) > { > bool result = false; > try { > TextMessage* message = session->createTextMessage( msg ); > producer->send( message ); > delete message; > > result = true; > } > catch (activemq::exceptions::ActiveMQException& e) { // <------<<<< catches the exception after the broker has been shutdown (transport is closed) > // Close open resources. > try{ > if( session != NULL ){ > session->close(); // <--------<<<< Causes unhandled exceptions > } > // close connection... > // free everything else... > } > } > return result; > } > void main() > { > if (initialise()){ > while (1){ > // do things to create the data to send... > // send data > sendMessage("fred"); > // sleep for a bit.... > // <<<< KILL THE BROKER SOMETIME DURING THIS LOOP >>>> > } > // clean up ..... > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.