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:
Trivial patch: Index: cpp/src/qpid/broker/SessionState.cpp =================================================================== --- cpp/src/qpid/broker/SessionState.cpp (revision 1622984) +++ cpp/src/qpid/broker/SessionState.cpp (working copy) @@ -69,7 +69,7 @@ if (parent != 0) { ManagementAgent* agent = getBroker().getManagementAgent(); if (agent != 0) { - std::string name(getId().getName()); + std::string name(getId().str()); std::string fullName(name); if (name.length() >= std::numeric_limits<uint8_t>::max()) name.resize(std::numeric_limits<uint8_t>::max()-1); posted for review if it can't break anything (e.g. in QMF, backward compatibility or so) - in https://reviews.apache.org/r/25418/ .
Committed revision 1624473.
Patch in comment 1 has some side-effects also mentioned by patch reviewer. I created separate defect bug 1249948 comment 5 with alternative patch.
The fix was successfully verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHEA-2015-1879.html