all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* dbus-call-method blocks for a long time
@ 2013-02-14 19:04 Lluís
  2013-02-15 10:48 ` Michael Albinus
  0 siblings, 1 reply; 3+ messages in thread
From: Lluís @ 2013-02-14 19:04 UTC (permalink / raw)
  To: emacs-devel

I'm not quite sure if this is an issue with `notifications' but this piece of
code is getting my emacs completely frozen for a while every time it calls
`notifications-notify' (sometimes not even C-g gets out of it):

#v+
(defun gnus-notifications-notify (from subject photo-file)
  "Send a notification about a new mail.
Return a notification id if any, or t on success."
  (if (fboundp 'notifications-notify)
      (gnus-funcall-no-warning
       'notifications-notify
       :title from
       :body subject
       :actions '("read" "Read")
       :on-action 'gnus-notifications-action
       :app-icon (gnus-funcall-no-warning
		  'image-search-load-path "gnus/gnus.png")
       :app-name "Gnus"
       :category "email.arrived"
       :timeout gnus-notifications-timeout
       :image-path photo-file)
    (message "New message from %s: %s" from subject)
    ;; Don't return an id
    t))
#v-

This is what `elp-results' gave me:

gnus-notifications                    1           150.11820929  150.11820929
gnus-notifications-notify             3           150.09452521  50.031508405
notifications-notify                  3           150.09438033  50.031460111
dbus-call-method                      6           150.09408380  25.015680634
dbus-get-name-owner                   3           75.051887114  25.017295704
gnus-notifications-get-photo-file     3           0.0023640640  0.0007880213
gnus-notifications-get-photo          3           0.002331871   0.0007772903
dbus-message-internal                 6           0.0006671940  0.0001111990
dbus-handle-event                     6           0.000134238   2.2373e-05
dbus-call-method-handler              6           8.296...e-05  1.382...e-05
dbus-event-serial-number              6           2.388e-05     3.98e-06
dbus-event-bus-name                   6           2.042...e-05  3.403...e-06
dbus-check-event                      20          1.7564e-05    8.782e-07


Looks strange to me that `dbus-call-method' takes so long while the notification
message appears immediately on my screen.

Does this sound like a problem in Emacs's DBus immplementation, or should I
rather look in another direction?

This is using Julien's emacs-snapshot (24.3.50.1) version 2:20130207-1.


Thanks,
  Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dbus-call-method blocks for a long time
  2013-02-14 19:04 dbus-call-method blocks for a long time Lluís
@ 2013-02-15 10:48 ` Michael Albinus
  2013-02-15 17:43   ` Lluís
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Albinus @ 2013-02-15 10:48 UTC (permalink / raw)
  To: emacs-devel

Lluís <xscript@gmx.net> writes:

Hi Lluís,

> I'm not quite sure if this is an issue with `notifications' but this piece of
> code is getting my emacs completely frozen for a while every time it calls
> `notifications-notify' (sometimes not even C-g gets out of it):
>
> #v+
> (defun gnus-notifications-notify (from subject photo-file)
>   "Send a notification about a new mail.
> Return a notification id if any, or t on success."
>   (if (fboundp 'notifications-notify)
>       (gnus-funcall-no-warning
>        'notifications-notify
>        :title from
>        :body subject
>        :actions '("read" "Read")
>        :on-action 'gnus-notifications-action
>        :app-icon (gnus-funcall-no-warning
> 		  'image-search-load-path "gnus/gnus.png")
>        :app-name "Gnus"
>        :category "email.arrived"
>        :timeout gnus-notifications-timeout
>        :image-path photo-file)
>     (message "New message from %s: %s" from subject)
>     ;; Don't return an id
>     t))
> #v-

`notifications-notify' doesn't set a timeout for `dbus-call-method' and
`dbus-get-name-owner' (maybe they should). Therefore, the default
timeout of D-Bus is used, which is 25,000 milliseconds. And indeed, both
functions wait exactly this time:

> dbus-call-method                      6           150.09408380  25.015680634
> dbus-get-name-owner                   3           75.051887114  25.017295704

> Looks strange to me that `dbus-call-method' takes so long while the notification
> message appears immediately on my screen.

This is really strange. When the notification appears on your desktop,
`dbus-call-method' has been applied successfully. But Emacs does not
receive the return message of that call.

> Does this sound like a problem in Emacs's DBus immplementation, or should I
> rather look in another direction?

Do you have some special settings wrt D-Bus? For example, do you play
with $DBUS_SESSION_BUS_ADDRESS, or do you use a private D-Bus
connection?

Could you trace D-Bus events in a shell outside Emacs, by calling
"dbus-monitor"? In parallel, you might also trace D-Bus events inside
Emacs by setting `dbus-debug' to `t'.

> Thanks,
>   Lluis

Best regards, Michael.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dbus-call-method blocks for a long time
  2013-02-15 10:48 ` Michael Albinus
@ 2013-02-15 17:43   ` Lluís
  0 siblings, 0 replies; 3+ messages in thread
From: Lluís @ 2013-02-15 17:43 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

Michael Albinus writes:
[...]
>> Does this sound like a problem in Emacs's DBus immplementation, or should I
>> rather look in another direction?

> Do you have some special settings wrt D-Bus? For example, do you play
> with $DBUS_SESSION_BUS_ADDRESS, or do you use a private D-Bus
> connection?

Nope.


> Could you trace D-Bus events in a shell outside Emacs, by calling
> "dbus-monitor"? In parallel, you might also trace D-Bus events inside
> Emacs by setting `dbus-debug' to `t'.

For some reason that escapes my knowledge, it was working perfectly now. If I
ever get it to "fail" consistently again I will respond with the logs.


Thanks,
  Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-15 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14 19:04 dbus-call-method blocks for a long time Lluís
2013-02-15 10:48 ` Michael Albinus
2013-02-15 17:43   ` Lluís

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.