You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by BigSam72 <ra...@physter.com> on 2006/07/13 11:12:26 UTC

Bug in MessageConsumer::receive

Hi, i am using openwirte implementation and during development process i find
a bug in the implementation of MessageConsumer::receive.

Whe queue is empty, receive() call dispatcher::dequeue which returns msg
with NULL and after that is called MessageConsumer::autoAcknowledge() which
doesn't test if message is NULL and process fails ( generates coredump ) ...

Here is stacktrace of my app ...
#0  0x00a8bb51 in apache::activemq::MessageConsumer::autoAcknowledge () from
/home/sedmak/deploy/lib/libIOPAMQPlugin.so
#1  0x00a8c118 in apache::activemq::MessageConsumer::receive () from
/home/sedmak/deploy/lib/libIOPAMQPlugin.so
#2  0x00a2a1e1 in
phoenix::EventHandler::plugins::PhoenixActiveMQ::waitForMessage
(this=0x91d2828) at IOPActiveMQ.cpp:115
#3  0x00a2c75e in
phoenix::EventHandler::plugins::IOPActiveMQ::HandleNewRequest
(this=0x91d23e0, lpParams=0xb5fb2410) at IOPActiveMQ.cpp:423
#4  0x00a2c2e3 in phoenix::EventHandler::plugins::WrapperFunction
(lpParams=0x91d23e0) at IOPActiveMQ.cpp:385
#5  0x0016371d in StartThreadFunction (lpParams=0x91bb480) at unix.cpp:1802
#6  0x00197371 in start_thread () from /lib/tls/libpthread.so.0
#7  0x007999be in clone () from /lib/tls/libc.so.6

-- 
View this message in context: http://www.nabble.com/Bug-in-MessageConsumer%3A%3Areceive-tf1936063.html#a5304611
Sent from the ActiveMQ - Dev forum at Nabble.com.


Re: Bug in MessageConsumer::receive

Posted by BigSam72 <ra...@physter.com>.
My workaround:  if ( message != NULL ) ....

p<IMessage> MessageConsumer::autoAcknowledge(p<IMessage> message)
{
    try
    {
        if ( message != NULL ) {
          // Is the message an ActiveMQMessage? (throws bad_cast otherwise)
          p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage>
(message) ;

          // Register the handler for client acknowledgment
          activeMessage->setAcknowledger( smartify(this) ) ;

          if( acknowledgementMode != ClientAckMode )
              doAcknowledge(activeMessage) ;
        }
    }
    catch( bad_cast& bc )
    {
        // ignore
    }
    return message ;
}

-- 
View this message in context: http://www.nabble.com/Bug-in-MessageConsumer%3A%3Areceive-tf1936063.html#a5304689
Sent from the ActiveMQ - Dev forum at Nabble.com.