libnotify: system freezes for a few secs. on notify_notification_show

View: New views
3 Messages — Rating Filter:   Alert me  

libnotify: system freezes for a few secs. on notify_notification_show

by Sundaram-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi,
Is libnotify thread safe? Should I call dbus_g_thread_init() to make sure it is?

I have written a Eng. thesaurus Artha using GLib & GTK+, in which, when I get a particular hot key combination, on that key press signal handler, I call notify_notification_show() [before this, I close any earlier notifications by notify_notification_close()]. Everything works fine.

But, when I press that hot key combo more than a few times, say 10, for a first few I get notification after notification, but towards the end (arbitrary), the app. freezes and even the desktop freezes for a few seconds (8 to 10 secs) and then I see the notification and everything gets back to normal, including my app. But when this happens, notify_notification_show() returns a FALSE (eventhough a notification was shown), and GError msg reads thus: "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.".

As for the code, before calling any other func. I call g_thread_init(), then dbus_g_thread_init and notify_init() and then get a notifier handle by calling notify_notification_new_with_status_icon() with a GtkStatus icon, in my main, all of them only once. After that, when in gtk_main() loop, when ever I get a hot key press signal every time, I update the body & summary of the same notifier with a new one using notify_notification_update() and then call notify_notification_show(). I haven't used any thread related functions except the above ones (init). Is anything wrong in this approach that libnotify's notify_notification_show() chokes the whole system for a few seconds, because of my wrong way of using it? Or is it a glitch on libnotify's side?

Thanks!

Regards,
Sundaram


_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel

Re: libnotify: system freezes for a few secs. on notify_notification_show

by Christian Hammond-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

libnotify is a thin wrapper around D-BUS, and all communication happens within D-BUS. I don't have experience with libnotify and threads either (as I tend to avoid threads in my apps). It's possible that it's libnotify, but I would start off assuming the issue has to do with your app and D-BUS in some way.

Christian

--
Christian Hammond - chipx86@...
VMware, Inc.


On Thu, Feb 5, 2009 at 1:16 AM, Sundaram <legends2k@...> wrote:
Hi,
Is libnotify thread safe? Should I call dbus_g_thread_init() to make sure it is?

I have written a Eng. thesaurus Artha using GLib & GTK+, in which, when I get a particular hot key combination, on that key press signal handler, I call notify_notification_show() [before this, I close any earlier notifications by notify_notification_close()]. Everything works fine.

But, when I press that hot key combo more than a few times, say 10, for a first few I get notification after notification, but towards the end (arbitrary), the app. freezes and even the desktop freezes for a few seconds (8 to 10 secs) and then I see the notification and everything gets back to normal, including my app. But when this happens, notify_notification_show() returns a FALSE (eventhough a notification was shown), and GError msg reads thus: "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.".

As for the code, before calling any other func. I call g_thread_init(), then dbus_g_thread_init and notify_init() and then get a notifier handle by calling notify_notification_new_with_status_icon() with a GtkStatus icon, in my main, all of them only once. After that, when in gtk_main() loop, when ever I get a hot key press signal every time, I update the body & summary of the same notifier with a new one using notify_notification_update() and then call notify_notification_show(). I haven't used any thread related functions except the above ones (init). Is anything wrong in this approach that libnotify's notify_notification_show() chokes the whole system for a few seconds, because of my wrong way of using it? Or is it a glitch on libnotify's side?

Thanks!

Regards,
Sundaram


_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel



_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel

Re: libnotify: system freezes for a few secs. on notify_notification_show

by Sundaram-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi,
In my application, I haven't spawned a single thread nor do I call any dbus functions as I don't require both of them, it only the notifications thats needed. Still the control is stuck at the notify_notification_show() function call and then after the choke, it returns back to normal flow. In fact, the function calls g_thread_init and dbus_g_thread_init() was put after which the hangs got less, while I have tried both with and without these calls and still some times it hangs. Is libnotify using dbus func. sync or async?

Anyways, many thanks for the reply!

Regards,
Sundaram


From: Christian Hammond <chipx86@...>
To: Sundaram <legends2k@...>
Cc: galago-devel@...
Sent: Thursday, February 5, 2009 2:58:35 PM
Subject: Re: [Galago-devel] libnotify: system freezes for a few secs. on notify_notification_show

Hi,

libnotify is a thin wrapper around D-BUS, and all communication happens within D-BUS. I don't have experience with libnotify and threads either (as I tend to avoid threads in my apps). It's possible that it's libnotify, but I would start off assuming the issue has to do with your app and D-BUS in some way.

Christian

--
Christian Hammond - chipx86@...
VMware, Inc.


On Thu, Feb 5, 2009 at 1:16 AM, Sundaram <legends2k@...> wrote:
Hi,
Is libnotify thread safe? Should I call dbus_g_thread_init() to make sure it is?

I have written a Eng. thesaurus Artha using GLib & GTK+, in which, when I get a particular hot key combination, on that key press signal handler, I call notify_notification_show() [before this, I close any earlier notifications by notify_notification_close()]. Everything works fine.

But, when I press that hot key combo more than a few times, say 10, for a first few I get notification after notification, but towards the end (arbitrary), the app. freezes and even the desktop freezes for a few seconds (8 to 10 secs) and then I see the notification and everything gets back to normal, including my app. But when this happens, notify_notification_show() returns a FALSE (eventhough a notification was shown), and GError msg reads thus: "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.".

As for the code, before calling any other func. I call g_thread_init(), then dbus_g_thread_init and notify_init() and then get a notifier handle by calling notify_notification_new_with_status_icon() with a GtkStatus icon, in my main, all of them only once. After that, when in gtk_main() loop, when ever I get a hot key press signal every time, I update the body & summary of the same notifier with a new one using notify_notification_update() and then call notify_notification_show(). I haven't used any thread related functions except the above ones (init). Is anything wrong in this approach that libnotify's notify_notification_show() chokes the whole system for a few seconds, because of my wrong way of using it? Or is it a glitch on libnotify's side?

Thanks!

Regards,
Sundaram


_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel




_______________________________________________
galago-devel mailing list
galago-devel@...
http://lists.freedesktop.org/mailman/listinfo/galago-devel