ActiveMQ C++ Client
  1. ActiveMQ C++ Client
  2. AMQCPP-532

Frequently deleting queue browser causes access violation

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.8.2
    • Fix Version/s: 3.9.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      Windows

      Description

      The following code should reproduce this issue :

      #include <activemq/library/ActiveMQCPP.h>
      #include <activemq/core/ActiveMQConnectionFactory.h>
      #include <activemq/commands/ActiveMQQueue.h>

      using namespace cms;

      int main()
      {
      try
      {
      activemq::library::ActiveMQCPP::initializeLibrary();
      activemq::core::ActiveMQConnectionFactory connectionFactory( "tcp://localhost:61616" );
      auto connection = connectionFactory.createConnection();
      connection->start();
      auto session = connection->createSession( Session::SESSION_TRANSACTED );

      activemq::commands::ActiveMQQueue queue( "testqueue" ); //sometimes it doesn't crash if the queue is empty so it should have atleast a message
      while ( 1 )

      { auto queueBrowser = session->createBrowser( &queue, "" ); auto enumeration = queueBrowser->getEnumeration(); if ( enumeration->hasMoreMessages() ) auto message = enumeration->nextMessage(); delete queueBrowser; }

      }
      catch ( const std::exception& e )

      { std::string what = e.what(); //sometimes it throws an exception like "Monitor is still in use!" }

      while ( 1 ) {} //wait, sometimes an activemq thread fails
      }

      1. stacktrace.txt
        6 kB
        Andrei Gheorghe
      2. crash.cpp
        1 kB
        Andrei Gheorghe

        Activity

        Hide
        Timothy Bish added a comment -

        Added some additional safety measures to try and prevent any message available notifications during shutdown.

        Show
        Timothy Bish added a comment - Added some additional safety measures to try and prevent any message available notifications during shutdown.
        Hide
        ASF subversion and git services added a comment -

        Commit d96e76169265269ad2a52041ec5c1a41549d3299 in activemq-cpp's branch refs/heads/master from Timothy Bish
        [ https://git-wip-us.apache.org/repos/asf?p=activemq-cpp.git;h=d96e761 ]

        https://issues.apache.org/jira/browse/AMQCPP-532

        Add some additional safety measures to try and prevent message available
        callback while destroying a browser object.

        Show
        ASF subversion and git services added a comment - Commit d96e76169265269ad2a52041ec5c1a41549d3299 in activemq-cpp's branch refs/heads/master from Timothy Bish [ https://git-wip-us.apache.org/repos/asf?p=activemq-cpp.git;h=d96e761 ] https://issues.apache.org/jira/browse/AMQCPP-532 Add some additional safety measures to try and prevent message available callback while destroying a browser object.
        Hide
        Timothy Bish added a comment -

        Saw a segfault during a few test runs.

        Show
        Timothy Bish added a comment - Saw a segfault during a few test runs.
        Hide
        Timothy Bish added a comment -

        Tested with multiple variations of the supplied test code on master on Linux and Windows and I could not reproduce this.

        Show
        Timothy Bish added a comment - Tested with multiple variations of the supplied test code on master on Linux and Windows and I could not reproduce this.
        Hide
        Andrei Gheorghe added a comment -

        I've tried closing the queuebrowser but unfortunally it still crashes.

        Show
        Andrei Gheorghe added a comment - I've tried closing the queuebrowser but unfortunally it still crashes.
        Hide
        Timothy Bish added a comment -

        Try closing the browser before deleting it

        Show
        Timothy Bish added a comment - Try closing the browser before deleting it
        Hide
        Andrei Gheorghe added a comment -

        Sometimes it doesn't crash and sometimes it takes a while ( sometimes a few minutes ). There are two ways it can crash and I've attached both stacktraces.

        Show
        Andrei Gheorghe added a comment - Sometimes it doesn't crash and sometimes it takes a while ( sometimes a few minutes ). There are two ways it can crash and I've attached both stacktraces.
        Hide
        Timothy Bish added a comment -

        Added an integration test on trunk and in 3.8.x but could not reproduce this. Might want to try and capture a thread back trace when this happens to see where the issue originates.

        Show
        Timothy Bish added a comment - Added an integration test on trunk and in 3.8.x but could not reproduce this. Might want to try and capture a thread back trace when this happens to see where the issue originates.
        Hide
        Andrei Gheorghe added a comment -

        This program crashes using the latest ActiveMQ-CPP version.

        Show
        Andrei Gheorghe added a comment - This program crashes using the latest ActiveMQ-CPP version.

          People

          • Assignee:
            Timothy Bish
            Reporter:
            Andrei Gheorghe
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development