[jira] Commented: (AMQCPP-58) Possible memory leak when reestablishing connection

2007-01-27 Thread Nathan Mittler (JIRA)

[ 
https://issues.apache.org/activemq/browse/AMQCPP-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_38022
 ] 

Nathan Mittler commented on AMQCPP-58:
--

I've done a bit of clean up to catch various error conditions and clean up 
properly.  Try the latest trunk and see if that leak goes away.

 Possible memory leak when reestablishing connection
 ---

 Key: AMQCPP-58
 URL: https://issues.apache.org/activemq/browse/AMQCPP-58
 Project: ActiveMQ C++ Client
  Issue Type: Bug
Affects Versions: 2.0
Reporter: Albert Strasheim
 Assigned To: Nathan Mittler
 Fix For: 2.0

 Attachments: leaker.cpp, purify-example.txt, socketleak1.diff


 Brought over from AMQCPP-46.
 There seems to be a memory leak when running the example program from 
 AMQCPP-46 which reconnects whenever the broker goes down.
 Valgrind says:
 {noformat}
 ==15493== 149,520 (89,712 direct, 59,808 indirect) bytes in 1,869 blocks are 
 definitely lost in loss record 55 of 55
 ==15493==at 0x4A19DE3: operator new(unsigned long) 
 (vg_replace_malloc.c:168)
 ==15493==by 0x45DEDD: 
 activemq::network::SocketFactory::createSocket(activemq::util::Properties 
 const) (SocketFactory.cpp:96)
 ==15493==by 0x458D0C: 
 activemq::transport::TcpTransport::TcpTransport(activemq::util::Properties 
 const, activemq::transport::Transport*, bool) (TcpTransport.cpp:42)
 ==15493==by 0x42B3EE: 
 activemq::transport::TcpTransportFactory::createTransport(activemq::util::Properties
  const) (TcpTransportFactory.cpp:55)
 ==15493==by 0x404CC0: 
 activemq::core::ActiveMQConnectionFactory::createConnection(std::string 
 const, std::string const, std::string const) 
 (ActiveMQConnectionFactory.cpp:130)
 ==15493==by 0x4042D5: 
 activemq::core::ActiveMQConnectionFactory::createConnection() 
 (ActiveMQConnectionFactory.cpp:69)
 ==15493==by 0x403D67: main (main.cpp:30)
 {noformat}
 Purify also seems to indicate that there is a link, along with with possibly 
 spurious leaks or leaks that might be related to the leak reported by 
 Valgrind.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (AMQCPP-59) Exception is thrown when destroying consumer after connection failure

2007-01-27 Thread Nathan Mittler (JIRA)

[ 
https://issues.apache.org/activemq/browse/AMQCPP-59?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_38024
 ] 

Nathan Mittler commented on AMQCPP-59:
--

Albert,
I think the issue was your main module.  It wasn't destroying the resources it 
allocated each time through the loop.  I've fixed this in the code below.  Give 
it a try and see if you're still having problems.

{code:title=main.cpp|borderStyle=solid}
#include activemq/core/ActiveMQConnectionFactory.h
#include cms/ExceptionListener.h
#include cms/Session.h
#include iostream

struct ExceptionListener : public cms::ExceptionListener {
bool error;

ExceptionListener() : error(false) {}

virtual ~ExceptionListener(void) {}
   
virtual void onException( const cms::CMSException ex ) {
std::cout  Got an exception in listener:   ex.getMessage()  
std::endl;
error = true;
}
};

ExceptionListener exListener;

activemq::core::ActiveMQConnectionFactory* connectionFactory = NULL;
cms::Connection* connection = NULL;
cms::Session* session = NULL;
cms::Destination* destination = NULL;
cms::MessageConsumer* consumer = NULL;

void cleanup(){
if( consumer != NULL ){
delete consumer;
consumer = NULL;
}
if( destination != NULL ){
delete destination;
destination = NULL;
}
if( session != NULL ){
delete session;
session = NULL;
}
if( connection != NULL ){
delete connection;
connection = NULL;
}
if( connectionFactory != NULL ){
delete connectionFactory;
connectionFactory = 0;
}
exListener.error = false;
}

int main(int argc, char* argv[]) {

while( true ) {
try {
activemq::core::ActiveMQConnectionFactory* connectionFactory =
new 
activemq::core::ActiveMQConnectionFactory(tcp://127.0.0.1:61613);
connection = connectionFactory-createConnection();
connection-setExceptionListener(exListener);
session = connection-createSession( cms::Session::AUTO_ACKNOWLEDGE 
);
destination = session-createTopic( TEST.FOO );
consumer = session-createConsumer( destination );
connection-start();
cms::Message* message = consumer-receive(1);
delete message;
message = 0;
cleanup();
} catch ( cms::CMSException ex ) {
std::cout  Got an exception:   ex.getMessage()  std::endl;
}
cleanup();
}

return 0;
}

{code}

 Exception is thrown when destroying consumer after connection failure
 -

 Key: AMQCPP-59
 URL: https://issues.apache.org/activemq/browse/AMQCPP-59
 Project: ActiveMQ C++ Client
  Issue Type: Bug
Affects Versions: 2.0
Reporter: Albert Strasheim
 Assigned To: Nathan Mittler
 Fix For: 2.0


 Brought over from AMQCPP-46.
 In a program that reconnects when it detects a connection failure using an 
 exception listener, there seem to be two different places where exceptions 
 can originate.
 In most cases when I shut down the broker and the exception listener fires 
 properly and I can clean up everything (without deletes throwing exceptions), 
 the stack trace that gets printed on the console looks like this:
 {noformat}
 WARNING: activemq::io::SocketInputStream::read - The connection is broken
 FILE: ..\src\main\activemq\network\SocketInputStream.cpp, LINE: 137
 FILE: ..\src\main\activemq\io\BufferedInputStream.cpp, LINE: 199
 FILE: ..\src\main\activemq\io\BufferedInputStream.cpp, LINE: 83
 FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, 
 LINE: 216
 FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, 
 LINE: 120
 FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, 
 LINE: 71
 FILE: ..\src\main\activemq\transport\IOTransport.cpp, LINE: 175
 {noformat}
 The message is printed twice with different tids, from the two threads that 
 are active.
 Sometimes when I shut down the broker and the exception handler fires and I 
 clean up everything but then the consumer's destructor throws an exception. 
 In that case, the stack trace that is printed looks like this:
 {noformat}
 WARNING: activemq::io::SocketInputStream::read - An existing connection was 
 forcibly closed by the remote host.
 FILE: ..\src\main\activemq\network\SocketInputStream.cpp, LINE: 145
 FILE: ..\src\main\activemq\io\BufferedInputStream.cpp, LINE: 199
 FILE: ..\src\main\activemq\io\BufferedInputStream.cpp, LINE: 83
 FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, 
 LINE: 216
 FILE: ..\src\main\activemq\connector\stomp\StompCommandReader.cpp, 
 LINE: 120
 FILE: 

Re: wiki access

2007-01-27 Thread Hiram Chirino

Hi Nathan,

We recently moved the confluence instance.. Something must have gotten
borked.  I'll look into it.  BUT... I think we are looking into moving
the space on to ASF managed machines.. not sure how long that will
take so, I'll try to get this fix for you ASAP in the mean time.

On 1/27/07, Nathan Mittler [EMAIL PROTECTED] wrote:

Hey guys,
I've apparently lost my privileges to change our wiki.  Was just trying to
update the AMQCPP 1.1 release page (
http://www.activemq.org/site/activemq-cpp-11-release.html) and was denied.

Thanks,
Nate





--
Regards,
Hiram

Blog: http://hiramchirino.com


Re: wiki access

2007-01-27 Thread Nathan Mittler

Great - thanks!

On 1/27/07, Hiram Chirino [EMAIL PROTECTED] wrote:


Hi Nathan,

We recently moved the confluence instance.. Something must have gotten
borked.  I'll look into it.  BUT... I think we are looking into moving
the space on to ASF managed machines.. not sure how long that will
take so, I'll try to get this fix for you ASAP in the mean time.

On 1/27/07, Nathan Mittler [EMAIL PROTECTED] wrote:
 Hey guys,
 I've apparently lost my privileges to change our wiki.  Was just trying
to
 update the AMQCPP 1.1 release page (
 http://www.activemq.org/site/activemq-cpp-11-release.html) and was
denied.

 Thanks,
 Nate




--
Regards,
Hiram

Blog: http://hiramchirino.com