I have a strange issue with Dbus...
I use Dbus-1.
The issue is, that it only happens sometimes and at different parts.
Sometimes for IDAMsg_GetFontName, sometimes for IDAMsg_GetForeColor (e.g).
Maybe the program runs ten times fine, then one time with error. Or four times fine, then two times with error.
But it is always the same error message from my std::cout and Dbus:
Too few arguments
and
Did not receive a reply
But how can I have sometimes too few arguments?
And how can give Dbus this error message, as it looks, that a reply was send and got?
Help is really appreciated.
TIA
Earlybite
The Dbus message is:
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.
The sending of a method:
if(vMethod == IDAMsg_Init || vMethod == IDAMsg_GetFontName
|| vMethod == IDAMsg_AppQuit
|| vMethod == IDAMsg_GetBackColor || vMethod == IDAMsg_GetForeColor
|| vMethod == IDAMsg_GetBorderColor){
dbus_message_iter_init_append(msg, &args);
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &vMsg.Str_Send[0])) {
cout << "DBUS -- SEND -- OUT OF MEMORY 1" << endl; return 0;
}
if(vMethod == IDAMsg_GetBorderColor || vMethod == IDAMsg_AppQuit){
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &vMsg.Str_Send[1])) {
cout << "DBUS -- SEND -- OUT of Memory 2" << endl; return 0;
}
}
}
The reply is:
if(vMethod == IDAMsg_Init || vMethod == IDAMsg_AppQuit
|| vMethod == IDAMsg_GetFontName
|| vMethod == IDAMsg_GetBackColor || vMethod == IDAMsg_GetForeColor
|| vMethod == IDAMsg_GetBorderColor){
if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&args)){
cout << "DBUS -- REPLY -- ARG is not String 1 " << endl;
} else {
dbus_message_iter_get_basic(&args, &nStr_In[0]);
}
if(vMethod == IDAMsg_GetBorderColor || vMethod == IDAMsg_AppQuit){
if (!dbus_message_iter_next(&args)){
cout << "DBUS -- REPLY -- Message has too few arguments 1" << endl;
} else if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&args)){
cout << "DBUS -- REPLY -- Argument is not STRING 2" << endl;
} else {
dbus_message_iter_get_basic(&args, &nStr_In[1]);
}
}
reply = dbus_message_new_method_return(msg);
dbus_message_iter_init_append(reply, &args);
}
if(vMethod == IDAMsg_Init){
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_BOOLEAN, &stat)) {
cout << "DBUS -- REPLY -- OUT of Memory 1" << endl; return;
}
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_UINT32, &level)) {
cout << "DBUS -- REPLY -- OUT of Memory 2" << endl; return;
}
}
The std::cout output normally is:
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetForeColor
DBUS -- IDABrowse -- Got Reply 245_245_245 21614
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- IDABrowse -- Request send with : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Got Reply 102_143_165 21614
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- IDABrowse -- Request send with : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Got Reply 126_177_204 21614
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- IDABrowse -- Request send with : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Got Reply 148_207_239 21614
But if something went wrong it looks something like this:
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetForeColor
DBUS -- IDABase -- Got Reply 245_245_245 21614
IDA -- IDABase -- INCOMING CALLBACK : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABase -- Request send with : GetBorderColor
DBUS -- SEND -- Message has too few arguments 1
DBUS -- IDABase -- Got Reply 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. 32723
I think the issue is shown with this:
This is the normal order for output:
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- IDABrowse -- Request sending with : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Got Reply 126_177_204 21614
This when an error occurs:
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Request sending with : GetBorderColor
DBUS -- IDABrowse -- Got Reply 126_177_204 21614
If error, line 2 and 3 have changed.
Than, the reply exist before request sending...
The way to debug this is to use dbus-monitor
or Bustle to look at what the traffic (requests, replies, errors) is on the bus. That should pinpoint the error and show you what message is causing it.