While stress-testing private server, marshalling "aaah" causes an error: is there a limit on DBUS_TYPE_UNIX_FD values one can marshal in a single session?

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Aug 25 02:11:24 PDT 2011


On Wed, 24 Aug 2011 at 17:50:30 +0200, rony wrote:
> Is it possible that there is a limit for DBUS_TYPE_UNIX_FD values that
> can be generated in a single run of a private DBus server?

There is a maximum number of fds per process (all fds, including stdin, stdout,
stderr, all open files and sockets, any fds passed to you via D-Bus, one
fd per DBusConnection and one fd per DBusServer), and a maximum for the entire
system.

The limit is OS-dependent - on my Debian GNU/Linux laptop, the limits are
currently 1024 per process (ulimit -n) and 394112 for the whole system
(/proc/sys/fs/file-max).

In addition, libdbus limits each message to 1024 fds by default. You can
increase that limit with dbus_connection_set_max_message_unix_fds(), up to
the maximum number allowed by the protocol, which is
DBUS_MAXIMUM_MESSAGE_UNIX_FDS = 2**25.

> P.S.: Being totally unfamilar with UNIX_FD in this context, is there
> somewhere a documentation/example of how they need to be applied in
> dbus? (Noticing e.g. that a TCP/IP connection will not support UNIX_FDs.)

They're file descriptors passed over a Unix socket (the SCM_RIGHTS mechanism,
at least on Linux - the socket-level API might be different on other OSs), as
documented in the unix(7) man page. The GUnixFDMessage and GUnixFDList objects
in GIO are the same thing, and might be documented more clearly.

    smcv


More information about the dbus mailing list