[systemd-devel] Fwd: sdbus-filedescriptor does reproducibly NOT get triggered in a specific situation

Lennart Poettering lennart at poettering.net
Wed Dec 12 10:12:33 UTC 2018


On Mi, 12.12.18 11:00, Jan Mueller (janmueller.email at googlemail.com) wrote:

> Dear systemd folks,
>
>
> I have the following issue:
>
> An application does not receive dbus signals on its dbus file descriptor
> *while waiting* for a
>
> dbus-method response. Considered time frame: between sending the
> method-call and receiving
>
> its response. After the response is being received, the (indefinitely)
> queued signal is not delivered
>
> until another signal / method call triggers the sdbus file descriptor
> (which is supervised by
>
> select()/epoll()).
>
> I committed a brief example with some more extensive explanation to:
>
> https://github.com/mue-jan/dbus-missing-signals-or-fd-issue

Don't use select() anymore. It's inefficient and can't handle fds >
1024. Use poll() or epoll(). (I'll prep a patch now that removes any
mention of select() from our man pages, as we shouldn't mislead users
to ever use it.)

Morever, when waiting on a bus object you need to use the fd returned
by sd_bus_get_fd() and wait for the events returned by
sd_bus_get_events() (which are POLLIN/POLLOUT/… events). Yes this
could benefit from documentation. The timeout passed to poll() should
be the one returned by sd_bus_get_timeout() or shorter.

Whenever poll() reports anything call sd_bus_process(), which will do
the work.

Lennart

--
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list