MemoryError in D-Bus Python bindings

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Oct 29 03:05:24 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 28 Oct 2007 at 13:08:35 +0100, Sebastian Pölsterl wrote:
> I'm the maintainer of GNOME Deskbar-Applet. Recently, more and more bugs
>  [1][2] appear in bugzilla that say something about memory error or not
> enough memory in D-Bus.
> I was wondering if you could tell me when such errors are likely to
> appear. Unfortunately, the stacktraces aren't helpful.

Are you able to reproduce this under gdb? If so, please set a breakpoint on
PyErr_NoMemory and let me know what the C stack trace is ("bt full"
preferred).

libdbus has a number of places where error conditions will be reported
as a warning to stderr and an abort. If fatal warnings are not enabled
(e.g. they're not on Debian-derived distros like Ubuntu) then the function
will return a value that is meant to mean "out of memory"; dbus-python
translates this into a Python MemoryError. I wonder whether you've hit such
a case somehow?

dbus-python is meant to avoid all such error conditions, but that's not
always feasible. The most common reason for failure is trying to
serialize None into a dictionary or struct - libdbus makes it very hard
for me to recover from that, so I don't handle it very well. (I plan to
improve on this, but in order to do that I might have to add more API to
libdbus itself.)

However, in the two bugs you linked, the first stack level that's
implemented in C is:

#479397: _Connection.send_message_with_reply_and_block
#478758: _Connection.send_message_with_reply

so you can't be getting that particular failure (those functions don't
serialize anything). I think you might be getting a similar "failure to handle
failure" in the call to dbus_connection_send_with_reply_and_block or
dbus_connection_send_with_reply respectively.

You might have to be running Ubuntu gutsy (like the reporters of
the bugs you linked) or Debian testing/unstable to reproduce this. On
other distros it's possible that deskbar-applet will just warn and
abort.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net

iD8DBQFHJbBkWSc8zVUw7HYRAvR9AKCZ0kJxkRxm2g/iuBW15CZOU2AE5ACgzqdP
XwRI4FT8I+Qj2Sy4Z8DJ840=
=MKVY
-----END PGP SIGNATURE-----


More information about the dbus mailing list