Fwd: Dbus Threading Issue

Vinoth V v.vinoth3e at gmail.com
Fri Jun 8 03:07:03 PDT 2012


Hi all,

First let me explain my program and later will tell about the issue i am
facing with dbus.
******This is the function on the client side which is being called from
process A for 10000 times from 10 different threads ***********
static void TestfunctA(ELAPSED_TIME_STATS *et)
{

   int                        i;
   printf("\n\nstarting %s.\n", __FUNCTION__);
   InitElapsedTimeSet("VZPAL_GetVideoInputStatusInfo", et); //initializing
the time_spec struct
   for (i=1; i<=LoopCount; i++)
   {
      StartElapsedTimeMeasurement(et);// making note of the start time
      Result = function1(10, &variable);
      StopElapsedTimeMeasurement(et);//making note of the end time
   }
   DumpLatencyTimeSet(et);
   DumpElapsedTimeSet(et);
}

************ client glue file which actally calls the original fucntion on
the process B which is the server *****************
eVZPAL_ReturnCode function1 (
                           int   n,
                           int array[512])                 // input array,
will have to be passed as Glib variant
{

   GError            *error = NULL;
   GVariant          *gvarray;
   gconstpointer     structFromGV;
   gsize             dataSize;
   // call the sync version of the method,
   com_our_api_call_function1_sync (proxy,
                                      n, &gvarray, (gint*)&nResult,
                                      NULL, &error);
   if (error != NULL)
   {
      g_print("Error in %s, msg=\"%s\".\n", __FUNCTION__, error->message);
      g_object_unref(error);
   }
   structFromGV = g_variant_get_fixed_array(gvarray, &dataSize, sizeof
(guchar));
   memcpy(array, structFromGV, sizeof(array));
   g_variant_unref(gvarray);
    return nResult;
}


***********************This is the code for the Server side glue code which
runs on the process B***********************
in bus acquired function i registered the function1 with the respective
signal handler..
g_signal_connect(interface, "handle-get-function1",
G_CALLBACK(Do_function1),  NULL);

static gboolean Do_function1(
   ComlOurApi        *interface,
   GDBusMethodInvocation      *invocation,
   guint16                    n,
   int                           *InputStatus,
   gpointer                   user_data)
{
   GVariant                   *gvarray;
    int                         array[512];    // input struct, will have
to be passed as Glib variant
   // get the data from VZPALe.
   nResult = function1(n, &array);
   gv = g_variant_new_from_data(((const GVariantType *) "ay"),  &array,
                                           sizeof(array),
                                           TRUE, NULL, NULL);
   // send the results back to the client process
   coml_our_api_complete_function1 (interface, invocation,
                                            gvarray, (guint16) nResult);
   // a little test to see if main loop calls these functions
   //volatile pid_t callbackPid = getpid();
   //g_print("\n mainloop pid is %x, callback pid is %x.\n", mainLoopPid,
callbackPid);
   g_variant_unref(gvarray);
   (void) user_data;    //
   return TRUE;         // to indicate that we handled
}
This inturn calls a original function....

My issue is this program works perfectly fine... no errors but when i run
this client for 10000 run in 10 different  threads ( i am calling the same
API)
I am getting the error


*Error in VZPAL_TuneToChannel,
msg="GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message did not
receive a reply (timeout by message bus)".*
**
and automatically my server loses its message bus which was acquired.

I would like to know is there a work around for the same.. because my
system in real time scenario need to handle some 10000 calls from  more
than 50 threads, but where
as the dbus is failing when there is more than 6 threads are called for the
function which gives array or structure as out parameters during its call
back.

I observe this with functions having structure or array as out parameters,
which needs to be sent back to the client process.

and also the dbus thread timing and standard deviation of the dbus call
across the process in my system is 4.3 msec ,
which is three time slower than normal linux os.

standard deviation of the threads increases as the number of threads
increases.it varies from 3.5msec to 18 mesc which is not accpetable.

I have also tired to increase the reply time out in the configuration files
(system.conf and sessiont.conf ) but even that didnt help

Is there a solution for my problem..? I badly need to increase the dbus
performance..

kindly help me friends .Thanks in advance.

Regards
vinoth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20120608/adaa6c97/attachment.htm>


More information about the dbus mailing list