blocking dbus system

Auzinger, Robert Robert.Auzinger at socionext.com
Mon Apr 18 15:00:29 UTC 2016


Hi!
I'm new to the list and also to the dbus-topic, therefore please apologize in advance if I ask newbie questions.
We try to establish a dbus-system where at minimum 3 applications talk to each other over dbus. Probably there are up to 10 applications talking to each other.
At the moment there is already a problem with 3 applications. We have implemented a kind of DBus-Listener-thread which waits for incoming messages and process them if one is received.
FeatStd::Int DBusListenerThread::ThreadFn()
{
    static const FeatStd::Char* c_internalMsg = "org.freedesktop.DBus";
    dbus_connection_set_wakeup_main_function(DBusFunctions::GetConnection(), DBusListenerThread::WakeupFn, this, 0);

    while (GetStatus() == FeatStd::Internal::ThreadStatus::Running) {
        DBusConnection* conn = DBusFunctions::GetConnection();
        if (conn != 0) {
            dbus_connection_read_write(conn, 0);
            DBusMessage* msg = dbus_connection_pop_message(conn);
            if (msg != 0) {
                const FeatStd::Char* interface = dbus_message_get_interface(msg);
                if (interface != 0) {
                    printf("received: (%s, %d)\n", dbus_message_get_member(msg), dbus_message_get_serial(msg));
                    m_listener.Listen(*msg);
                    Sleep(1);
                }
                else {
                    printf("ERROR: Message with empty interface from %s !!\n", dbus_message_get_sender(msg)); => error output 1
                }

                dbus_message_unref(msg);
            }
        }
    }

    return 0;
}

Frequently we get a error when we try to send a new signal. Before the system is blocked completely and no dbus-output can be seen at all.
bool DBusFunctions::InitSignal()
{
    if (GetConnection() == 0) {
        printf("No DBus connection!\n");
        return false;
    }

    DBusError err;
    int ret = 0;

    // initialize the error value
    dbus_error_init(&err);

    // register our name on the bus, and check for errors
    ret = dbus_bus_request_name(GetConnection(), m_busName, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
    if (dbus_error_is_set(&err)) {
        fprintf(stderr, "Name Error (%s)\n", err.message); => error output 2
        dbus_error_free(&err);
    }
    if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret &&
        DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER != ret) {
        printf("DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret\n");
//        return false;
    }

    // create a signal & check for errors
    m_msg = dbus_message_new_signal(c_path,
        m_interface,
        m_name); // name of the signal

    if (NULL == m_msg)
    {
        fprintf(stderr, "Message Null\n");
        return false;
    }

    // append arguments onto signal
    dbus_message_iter_init_append(m_msg, &m_messageIterator);
    return true;
}

Do you have any idea what could be the reason for such behavior?
After a block the system is running for some time but blocks again very soon.

The error-output is the following:
Error output 1: ERROR: Message with empty interface from org.freedesktop.DBus !!
Error output 2: Name Error (Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.)

Thanks,
robert



Geschaeftsfuehrer/Managing Director: Shoji Ohashi, Amane Inoue
Sitz/Seat: Linz; Firmenbuch/Commercial Register: Landesgericht Linz FN313602f

This e-mail and any attachment contains information which is private and confidential and is intended for the addressee only. If you are not an addressee, you are not authorised to read, copy or use the e-mail or any attachment. If you have received this e-mail in error, please notify the sender by return e-mail and then delete it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20160418/5ecf33c4/attachment-0001.html>


More information about the dbus mailing list