[ 
https://issues.apache.org/jira/browse/QPID-712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12553731
 ] 

Andrew Stitcher commented on QPID-712:
--------------------------------------

The offending section of code is: (src/qpid/sys/Dispatcher.cpp:383)

    switch (type) {
    case Poller::READABLE:
        readableCallback(*this);
        break;
    case Poller::WRITABLE:
        writableCallback(*this);
        break;
    case Poller::READ_WRITABLE:
        readableCallback(*this);
        writableCallback(*this);
        break;
    case Poller::DISCONNECTED:
        {
        ScopedLock<Mutex> lock(stateLock);
        state = DELAYED_INACTIVE;
        }
        if (disconnectedCallback) {
            disconnectedCallback(*this);
        }
        break;
    default:
>>> This is where the assertion failure occurs
        assert(false);
>>>
    }

Upon some analysis and work with gdb it seems that type is Poller::INVALID

the ultimate place in the code that sets this value is here: 
(src/qpid/sys/posix/EpollPoller.cpp:159)

    static Poller::EventType epollToDirection(::__uint32_t events) {
        // POLLOUT & POLLHUP are mutually exclusive really, but at least 
socketpairs
        // can give you both!
        events = (events & ::EPOLLHUP) ? events & ~::EPOLLOUT : events;
        ::__uint32_t e = events & (::EPOLLIN | ::EPOLLOUT);
        switch (e) {
            case ::EPOLLIN: return Poller::READABLE;
            case ::EPOLLOUT: return Poller::WRITABLE;
            case ::EPOLLIN | ::EPOLLOUT: return Poller::READ_WRITABLE;
            default:return (events & ::EPOLLHUP) ? Poller::DISCONNECTED : 
Poller::INVALID;
        }
    }

This code does not expect to receive EPOLLERR as a possible event, but the 
manpage explicitly says that it can be received
in any epoll_wait and can't be masked.

So we change the code to treat EPOLLHUP and EPOLLERR as both causing a 
Poller::DISCONNECTED event.

> Broker assertion failure in line 404 of Dispatcher.cpp
> ------------------------------------------------------
>
>                 Key: QPID-712
>                 URL: https://issues.apache.org/jira/browse/QPID-712
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Broker
>            Reporter: Andrew Stitcher
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to