activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Strasheim (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AMQCPP-122) Crash on Windows when rapidly creating and destroying connections
Date Tue, 12 Jun 2007 14:06:33 GMT

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

Albert Strasheim commented on AMQCPP-122:
-----------------------------------------

I've found another crash that looks related to this issue. It only happens on Windows and
only with a Release build and only if you don't run the program from within Visual Studio.
I also have a dual core processor, which is probably a contributing factor.

The code:

#include <activemq/core/ActiveMQConnectionFactory.h>
#include <cms/Connection.h>
using namespace activemq::core;
using namespace cms;
int main(int argc, char* argv[]) {
    std::string brokerURI = "tcp://127.0.0.1:61613?wireFormat=openwire";
    ActiveMQConnectionFactory connectionFactory(brokerURI);
    cms::Connection* connection = 0;
    try {
        connection = connectionFactory.createConnection();
    } catch (cms::CMSException& ex) {
        std::cout << ex.what() << std::endl;
    }
    delete connection;
    connection = 0;
    return 0;
}

Notice that the wire format is Openwire but I'm connecting it to port 61613 where Stomp listens
by default. On Linux and with a Debug build on Windows the following is printed after about
10 seconds:

OpenWireFormatNegotiator::requestWire format negociation timeout: peer did not send his wire
format.

However, with a Windows Release build, the program crashes after this timeout. The stack trace
looks similar to the Stomp crash:

 	msvcr80.dll!fastcopy_I(void * dst=0x00359ba0, void * src=0x00003480, int len=0)  + 0x50
bytes	C
 	msvcr80.dll!_VEC_memcpy(void * dst=0x00359ba0, void * src=0x000034f8, int len=8)  + 0x52
bytes	C
 	msvcr80.dll!_VEC_memcpy(void * dst=0x00359b98, void * src=0x00003500, int len=3513120) 
+ 0xb4 bytes	C
 	ntdll.dll!7c915233() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]	
 	vs2005-activemq-example.exe!activemq::io::BufferedInputStream::read(unsigned char * targetBuffer=,
unsigned int targetBufferSize=)  Line 112	C++
 	vs2005-activemq-example.exe!activemq::io::DataInputStream::readByte()  Line 107 + 0x18 bytes
C++
 	msvcr80.dll!operator new(unsigned int size=11337808)  Line 59 + 0x8 bytes	C++
 	msvcr80.dll!_VEC_memzero(void * dst=0x00000000, int val=13560, int len=8)  + 0x36 bytes
C
 	msvcr80.dll!_VEC_memzero(void * dst=0x00000000, int val=3520656, int len=2084710757)  +
0x82 bytes	C
 	msvcp80.dll!std::char_traits<char>::assign(char * _First=0x00ad0048, unsigned int
_Count=13568, char _Ch=0)  Line 606 + 0x13 bytes	C++
 	msvcp80.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::_Chassign(unsigned int _Off=11337808, unsigned int _Count=0, char _Ch='ø')  Line 2006
+ 0x1f bytes	C++
 	msvcr80.dll!_VEC_memzero(void * dst=0x00000000, int val=3520656, int len=2084710757)  +
0x82 bytes	C
 	msvcp80.dll!std::char_traits<char>::assign(char * _First=0x00ad0048, unsigned int
_Count=13568, char _Ch=0)  Line 606 + 0x13 bytes	C++
 	msvcp80.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::_Chassign(unsigned int _Off=11337800, unsigned int _Count=0, char _Ch='')  Line 2006
+ 0x1f bytes	C++
 	msvcp80.dll!std::char_traits<char>::assign(char * _First=0x00ad0048, unsigned int
_Count=13568, char _Ch=0)  Line 606 + 0x13 bytes	C++
 	msvcp80.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::_Chassign(unsigned int _Off=0, unsigned int _Count=2084714695, char _Ch=0)  Line 2006
+ 0x1f bytes	C++
 	msvcp80.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::append(unsigned int _Count=13568, char _Ch='˜')  Line 1008	C++
 	msvcp80.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::resize(unsigned int _Newsize=11337800, char _Ch=0)  Line 1667	C++
 	vs2005-activemq-example.exe!activemq::io::DataInputStream::readUTF()  Line 270	C++
 	vs2005-activemq-example.exe!activemq::connector::openwire::marshal::BaseDataStreamMarshaller::looseUnmarshalString(activemq::io::DataInputStream
* dataIn=0x00acf698)  Line 321	C++
 	vs2005-activemq-example.exe!activemq::connector::openwire::marshal::v2::ConnectionIdMarshaller::looseUnmarshal(activemq::connector::openwire::OpenWireFormat
* wireFormat=0x003598b8, activemq::connector::openwire::commands::DataStructure * dataStructure=0x00acf698,
activemq::io::DataInputStream * dataIn=0x7ffddc00)  Line 106 + 0xe bytes	C++
 	vs2005-activemq-example.exe!activemq::connector::openwire::OpenWireFormat::doUnmarshal(activemq::io::DataInputStream
* dis=0x00000000)  Line 249	C++
 	vs2005-activemq-example.exe!activemq::connector::openwire::OpenWireFormat::unmarshal(activemq::io::DataInputStream
* dis=0x003598b8)  Line 185 + 0x9 bytes	C++
 	vs2005-activemq-example.exe!activemq::connector::openwire::OpenWireCommandReader::readCommand()
 Line 76	C++
>	vs2005-activemq-example.exe!activemq::transport::IOTransport::run()  Line 169	C++

In the main thread, it is waiting on the IOTransport to close:

 	vs2005-activemq-example.exe!activemq::concurrent::Thread::join()  Line 108	C++
 	ntdll.dll!7c911970() 	
 	ntdll.dll!7c911902() 	
>	vs2005-activemq-example.exe!activemq::transport::IOTransport::close()  Line 143	C++
 	vs2005-activemq-example.exe!activemq::transport::filters::TcpTransport::close()  Line 148
C++
 	vs2005-activemq-example.exe!activemq::transport::filters::ResponseCorrelator::close()  Line
240	C++
 	vs2005-activemq-example.exe!activemq::connector::openwire::OpenWireFormatNegotiator::~OpenWireFormatNegotiator()
 Line 49 + 0x1a bytes	C++
 	vs2005-activemq-example.exe!activemq::connector::openwire::OpenWireFormatNegotiator::`scalar
deleting destructor'()  + 0x8 bytes	C++
 	vs2005-activemq-example.exe!activemq::connector::openwire::OpenWireConnector::~OpenWireConnector()
 Line 119	C++
 	vs2005-activemq-example.exe!activemq::connector::openwire::OpenWireConnector::`scalar deleting
destructor'()  + 0x8 bytes	C++
 	vs2005-activemq-example.exe!activemq::core::ActiveMQConnectionFactory::createConnection(const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
url="tcp://127.0.0.1:61613?wireFormat=openwire", const std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & username={...}, const std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & password={...}, const std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & clientId="b9fcd2b6-9767-4415-905e-69f3e96448ec")  Line 176	C++


> Crash on Windows when rapidly creating and destroying connections
> -----------------------------------------------------------------
>
>                 Key: AMQCPP-122
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-122
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>    Affects Versions: 2.1
>            Reporter: Albert Strasheim
>            Assignee: Timothy Bish
>             Fix For: 2.1
>
>
> Me again. :)
> The following program crashes within a few seconds on my Windows XP machine. This machine
has a Core 2 Duo processor (i. e. 2 cores).
> On my Pentium 4 + Hyperthreading Linux machine is only dies after about a minute with:
> terminate called after throwing an instance of 'activemq::exceptions::ActiveMQException'
>   what():  Cannot assign requested address
> Aborted
> However, this is to be expected, since the program causes thousands of sockets to be
created. This doesn't seem to be the reason it crashes on Windows though.
> The code:
> {code:none}
> #include <activemq/core/ActiveMQConnectionFactory.h> 
> #include <cms/Connection.h> 
> #include <cms/Session.h>
> #include <cms/MessageProducer.h>
> #include <cms/DeliveryMode.h>
> int main(int argc, char* argv[]) {                            
>   activemq::core::ActiveMQConnectionFactory connectionFactory("tcp://localhost:61613?wireFormat=stomp");
>   while(true)
>   {
>     cms::Connection* connection = connectionFactory.createConnection(); 
>     cms::Session* session = connection->createSession(cms::Session::AUTO_ACKNOWLEDGE);
>     cms::Topic* topic = session->createTopic("topic");
>     cms::MessageProducer* producer = session->createProducer(topic);
>     delete producer;
>     delete topic;
>     delete session; 
>     delete connection;
>   }
>   return 0;
> }
> {code}
> The stack trace when it crashes:
> >	activemq-cppd.dll!activemq::io::BufferedInputStream::read()  Line 79 + 0x12 bytes
C++
>  	activemq-cppd.dll!activemq::connector::stomp::StompCommandReader::readStompHeaderLine()
 Line 194 + 0x19 bytes	C++
>  	activemq-cppd.dll!activemq::connector::stomp::StompCommandReader::readStompCommandHeader(activemq::connector::stomp::StompFrame
& frame={...})  Line 101	C++
>  	activemq-cppd.dll!activemq::connector::stomp::StompCommandReader::readCommand()  Line
59	C++
>  	activemq-cppd.dll!activemq::transport::IOTransport::run()  Line 166 + 0x19 bytes	C++
>  	activemq-cppd.dll!activemq::concurrent::Thread::runCallback(void * param=0x003ad328)
 Line 152 + 0x13 bytes	C++
>  	msvcr80d.dll!_callthreadstartex()  Line 348 + 0xf bytes	C
>  	msvcr80d.dll!_threadstartex(void * ptd=0x003adac0)  Line 331	C
>  	kernel32.dll!7c80b683() 	
>  	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]

> The line in BufferedInputStream::read is:
> char returnValue = buffer[head++];
> There is a local variable called bufferSize with a value of 1024. However, the value
of head is usually much larger than bufferSize (like more than 10000).

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


Mime
View raw message