Pavel Moravec created QPID-6087:
-----------------------------------

             Summary:  QMF Session name to contain user ID for AMQP 0-10
                 Key: QPID-6087
                 URL: https://issues.apache.org/jira/browse/QPID-6087
             Project: Qpid
          Issue Type: Bug
          Components: C++ Broker
    Affects Versions: 0.28
            Reporter: Pavel Moravec
            Assignee: Pavel Moravec
            Priority: Minor


Description of problem:
AMQP 0-10 allows sessions of the same name attached in parallel by different 
users. Broker allows that, but QMF can't cope with it properly as it stores 
session object by its name - that is unique per one user only.

Therefore, QMF does not track all sessions, subscriptions (maybe something 
else) in those cases.

It is required to have unique session ID for QMF. Either having user ID as part 
of the session ID, or use pointer to the session object like AMQP 1.0 
implementation uses.


Version-Release number of selected component (if applicable):
any (0.18-30, 0.22-48)


How reproducible:
100%


Steps to Reproduce:
1) Have usera:usera and userb:userb credentials for qpid broker
2) Compile below program:

#include <cstdlib>
#include <iostream>

#include <sstream>

#include <qpid/messaging/Address.h>
#include <qpid/messaging/Connection.h>
#include <qpid/messaging/Message.h>
#include <qpid/messaging/Sender.h>
#include <qpid/messaging/Receiver.h>
#include <qpid/messaging/Session.h>


using namespace qpid::messaging;
using namespace qpid::types;

using std::stringstream;
using std::string;

int main(int argc, char** argv) {
    const char* session_name = argc>1 ? argv[1] : "session_name";
    const char* connectionOptions = argc>2 ? argv[2] : "{username:guest, 
password:guest}";
    const char* address = argc>3 ? argv[3] : "myQueue; {create:always}";
    Connection connection("localhost:5672", connectionOptions);
    try {
        connection.open();
        Session session = connection.createSession(session_name);
        Receiver receiver = session.createReceiver(address);
        receiver.fetch();

        connection.close();
        return 0;
    } catch(const std::exception& error) {
        std::cout << error.what() << std::endl;
        connection.close();
    }
    return 1;
}


3) ./session_attach_given_name aaa "{username:usera, password:usera}" &
4) ./session_attach_given_name aaa "{username:userb, password:userb}" &
5) grep errors in qpidd logs
6) check subscriptions (qpid-stat -u) and sessions (qpid-tool -> list session) 
that QMF is aware of


Actual results:
5) qpid prints errors:
2014-09-02 16:07:04 [Management] error Detected two management objects with the 
same identifier: 
0-51-1--17(org.apache.qpid.broker:subscription:org.apache.qpid.broker:session:aaa,org.apache.qpid.broker:queue:myQueue,myQueue)
2014-09-02 16:07:04 [Management] error Detected two management objects with the 
same identifier: 0-51-1--14(org.apache.qpid.broker:session:aaa)

6) there is just 1 subscription for "myQueue" queue (while both programs create 
one) and just 1 session named "aaa".


Expected results:
no error, 2 subscriptions, 2 sessions

Additional info:
AMQP 1.0 connections/session works well here, as AMQP 1.0 does not have named 
sessions and string of pointer is used rather.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to