Bug 699499

Summary: [RFE] qmfv2 must provide mainloop integration
Product: Red Hat Enterprise Linux 6 Reporter: Steven Dake <sdake>
Component: qpid-qmfAssignee: Darryl L. Pierce <dpierce>
Status: CLOSED ERRATA QA Contact: Petr Matousek <pematous>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1CC: iboverma, jneedle, jross, pematous, sgraf, syeghiay, tross
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-qmf-0.12-5 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 16:51:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 704353, 743047    

Description Steven Dake 2011-04-25 19:50:37 UTC
Description of problem:
qmfv2 does not provide a way to determine via a pollable file descriptor if a new event is available.

Version-Release number of selected component (if applicable):
rhel 6.1

How reproducible:
100%

Steps to Reproduce:
1. no api present
2.
3.
  
Actual results:
must simulate a pollable file descriptor by creating a timer to poll on a time interval to check for new events.

Expected results:
An api to get a pollable file descriptor should be made available.  When this pollable fd has a POLLIN event, a following event retrieval should result in an event without any delay related to timers for good high performance operation.

Additional info:

Workaround involves starting a timer to "poll" the event list via qmfv2.  Need a file descriptor to let the kernel do the polling so our apps don't chew cpu in cloud environments.

Comment 2 RHEL Program Management 2011-04-26 06:01:22 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 3 Steven Dake 2011-04-26 15:36:20 UTC
*** Bug 699501 has been marked as a duplicate of this bug. ***

Comment 4 Ted Ross 2011-09-13 21:50:35 UTC
Fixed upstream in revision 1170314.

Comment 5 Ted Ross 2011-09-13 22:12:51 UTC
An example program is provided to illustrate the use of the new, optional, feature.  Here is the Readers Digest version:

#include <qmf/posix/EventNotifier.h>

void MyAgent::mainloop()
{
    qmf::posix::EventNotifier notifier(agentSession);
    int qmf_fd(notifier.getHandle());

    // qmf_fd is a file descriptor that shall be readable if and only if
    // there is at least one qmf event to be processed.  The application should
    // neither read nor write data to or from this file descriptor.  It should
    // simply use it in select/poll to test its readability.
    //
    // If qmf_fd is readable, the application should call agentSession.nextEvent
    // with a timeout of qpid::messaging::Duration::IMMEDIATE to assure that the
    // call will never block.

    while (running) {
        ...
        retval = select(nfds, &rfds, NULL, NULL, &timeval);
        if (retval > 0 && FD_ISSET(qmf_fd, &rfds)) {
            AgentEvent event;
            while (agentSession.nextEvent(event, Duration::IMMEDIATE)) {
                // Process Event
            }
        }
        ...
    }
}

Note that the above is also usable for Console sessions.

Comment 7 Petr Matousek 2011-11-03 15:36:57 UTC
The issue has been fixed

Verified on RHEL6.2-20111019.2, architectures: i386, x86_64

packages installed:
python-qpid-0.12-1.el6.noarch
python-qpid-qmf-0.12-6.el6.x86_64
qpid-cpp-client-0.12-6.el6.x86_64
qpid-cpp-client-devel-0.12-6.el6.x86_64
qpid-cpp-client-rdma-0.12-6.el6.x86_64
qpid-cpp-client-ssl-0.12-6.el6.x86_64
qpid-cpp-debuginfo-0.12-6.el6.x86_64
qpid-cpp-server-0.12-6.el6.x86_64
qpid-cpp-server-cluster-0.12-6.el6.x86_64
qpid-cpp-server-devel-0.12-6.el6.x86_64
qpid-cpp-server-rdma-0.12-6.el6.x86_64
qpid-cpp-server-ssl-0.12-6.el6.x86_64
qpid-cpp-server-store-0.12-6.el6.x86_64
qpid-cpp-server-xml-0.12-6.el6.x86_64
qpid-java-client-0.10-11.el6.noarch
qpid-java-common-0.10-11.el6.noarch
qpid-java-example-0.10-11.el6.noarch
qpid-java-jca-0.10-11.el6.noarch
qpid-java-jca-zip-0.10-11.el6.noarch
qpid-qmf-0.12-6.el6.x86_64
qpid-qmf-debuginfo-0.12-6.el6.x86_64
qpid-qmf-devel-0.12-6.el6.x86_64
qpid-tests-0.12-1.el6.noarch
qpid-tools-0.12-2.el6.noarch
rh-qpid-cpp-tests-0.12-6.el6.x86_64
ruby-qpid-0.7.946106-2.el6.x86_64
ruby-qpid-qmf-0.12-6.el6.x86_64


-> VERIFIED

Comment 8 Justin Ross 2011-11-08 20:14:31 UTC
*** Bug 751865 has been marked as a duplicate of this bug. ***

Comment 9 errata-xmlrpc 2011-12-06 16:51:16 UTC
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.

http://rhn.redhat.com/errata/RHBA-2011-1671.html