From: Meier, A. <and...@sc...> - 2009-10-23 15:14:37
|
In the past week I worked on the echo example and tried to figure out why it did not work. It occurred to me that the multi threading cannot work since libdbus does a poll and dbus-cplusplus does a poll as well on the same file descriptor which cannot be safe. My echo-client blocked for 25 secs after a client issued a Hello request. The server's response let the dispatcher return from the poll call. The following watch_ready read the message from the socket but had it not ready to dispatch before the client issued its blocking poll. Then the response was ready but the client could not be woken up. My first idea was that we must somehow be able to wake up the client, then I realized that this code was located in libdbus. The second idea was to have a separate connection for each server and client object. To ensure that the dispatcher is not polling the client connections and accidentally receive responses an additional dummy dispatcher must be created and set as default_dispatcher while creating the client connections. Please have a look at my patch. It fixed the echo example for me. Best regards, Andreas > -----Original Message----- > From: Andreas Volz [mailto:li...@br...] > Sent: Dienstag, 14. Juli 2009 17:48 > To: dbu...@li... > Subject: [sls][heur] Re: [dbus-cplusplus-devel] dbus-c++ echo sample fails > > Am Wed, 8 Jul 2009 11:04:50 -0700 schrieb Bruce, Henry: > > Yes, the example is bad. If someone provides a better one I'll commit > it. > > regards > Andreas > > > Sorry - just realized that applications set the main loop type. So > > echo sample still fails with Glib main loop. Maybe best just to > > remove it from the source tree. A sample that doesn't work is a > > barrier to adoption. > > > > The properties sample works just fine. Not sure why the client needs > > to spawn a thread. Can someone explain? > > > > I've got a Visual Studio build with the Glib main loop and the > > "properties" sample, but client / server comms are not working. Dbus > > monitor sees the client request, but server doesn't pick it up. I'll > > keep debugging. > > > > Henry > > > > > > -----Original Message----- > > From: Bruce, Henry [mailto:hen...@in...] > > Sent: Tuesday, July 07, 2009 12:05 PM > > To: dbu...@li... > > Subject: Re: [dbus-cplusplus-devel] dbus-c++ echo sample fails > > > > Thanks to all who replied to my email. I've been digging deeper and > > have some questions and comments > > > > 1. Does "main loop integration" apply to client and server > > applications and/or the binding library itself (i.e. dbus-c++ library) > > > > 2. I switched to echo client and server applications to use the Glib > > main loop but still see the same "OOM" error on the client. As the > > dispatch enter and leave method are stubbed out in the Glib > > implementation, I created my own main loop in the client and server > > applications. > > > > 3. Is it possible to change the main loop used by the binding? If so, > > are there instructions on how to do this ? I tried swapping out > > eventloop.h and for glib-integration.h in dispatcher.h and changing > > type of default_dispatcher accordingly, but got compiler errors > > (couldn't find any of the "Internal" sub classes). > > > > 4. If I can work out how to do (3) for Glib, I can see a route to > > Visual Studio port. > > > > Henry > > > > > > > > -----Original Message----- > > From: Andreas Volz [mailto:li...@br...] > > Sent: Thursday, July 02, 2009 12:45 PM > > To: dbu...@li... > > Subject: Re: [dbus-cplusplus-devel] dbus-c++ echo sample fails > > > > Am Tue, 30 Jun 2009 12:46:17 -0700 schrieb Bruce, Henry: > > > > Hello Henry, > > > > To be honest I know this comment, but never experienced this error. > > And I use Dbus-C++ for a heavy communicating application. > > > > Which main loop integration do you use? Try the Ecore or Glib loop. > > The default one is buggy. > > > > regards > > Andreas > > > > > All, > > > > > > I have been evaluating dbus-c++. I really like the design - it makes > > > good use of C++ and is much easier to use the dbus-glib. I also like > > > the use of XML service description files. When I built and ran the > > > "echo" sample, the client failed after a few requests with a "not > > > enough memory" exception. When I looked at the source for > > > echo-client.cpp I saw the comment "For some strange reason, libdbus > > > frequently dies with an OOM". Sure enough, it had. > > > > > > I'd really like to use dbus-c++, but it just doesn't seem stable > > > enough. Has anyone root caused this behavior? > > > > > > Hoping that someone will save me from dbus-glib, > > > > > > Thanks, > > > > > > Henry Bruce > > > > > > > > > > > > ------------------------------------------------------------------------ ------ > > > _______________________________________________ > > > dbus-cplusplus-devel mailing list > > > dbu...@li... > > > https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel > > > > > > > ------------------------------------------------------------------------ ------ > > _______________________________________________ > > dbus-cplusplus-devel mailing list > > dbu...@li... > > https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel > > > > ------------------------------------------------------------------------ ------ > > Enter the BlackBerry Developer Challenge > > This is your chance to win up to $100,000 in prizes! For a limited > > time, vendors submitting new applications to BlackBerry App World(TM) > > will have the opportunity to enter the BlackBerry Developer > > Challenge. See full prize details at: http://p.sf.net/sfu/blackberry > > _______________________________________________ > > dbus-cplusplus-devel mailing list > > dbu...@li... > > https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel > > ------------------------------------------------------------------------ ------ > > Enter the BlackBerry Developer Challenge > > This is your chance to win up to $100,000 in prizes! For a limited > > time, vendors submitting new applications to BlackBerry App World(TM) > > will have the opportunity to enter the BlackBerry Developer > > Challenge. See full prize details at: http://p.sf.net/sfu/Challenge > > _______________________________________________ > > dbus-cplusplus-devel mailing list > > dbu...@li... > > https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel > > > > ------------------------------------------------------------------------ ------ > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited time, > vendors submitting new applications to BlackBerry App World(TM) will have > the opportunity to enter the BlackBerry Developer Challenge. See full prize > details at: http://p.sf.net/sfu/Challenge > _______________________________________________ > dbus-cplusplus-devel mailing list > dbu...@li... > https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel |