[Bug 1890753] [NEW] DBusGMainLoop segfaults python if multi-threaded

Dan Streetman 1890753 at bugs.launchpad.net
Thu Aug 6 23:11:18 UTC 2020


Public bug reported:

python segfaults if DBusMainLoop is used in multiple threads; e.g.:

#!/usr/bin/python3

import dbus
import sys
import threading

from gi.repository import GLib

from dbus.mainloop.glib import DBusGMainLoop
#DBusGMainLoop(set_as_default=True)                                                                                                            

if __name__ == "__main__":
    threading.Thread(target=GLib.MainLoop().run).start()

    for r in range(1000):
        print(".", flush=True, end="")
        dbus.SessionBus(private=True, mainloop=DBusGMainLoop())
        #dbus.SessionBus(private=True)                                                                                                         

    print("")
    sys.exit(0)


$ ./test.py
.............Segmentation fault


It will also segfault if set_as_default is set to True, even without passing it to the SessionBus's mainloop parameter.

** Affects: dbus-python (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dbus-python in Ubuntu.
https://bugs.launchpad.net/bugs/1890753

Title:
  DBusGMainLoop segfaults python if multi-threaded

Status in dbus-python package in Ubuntu:
  New

Bug description:
  python segfaults if DBusMainLoop is used in multiple threads; e.g.:

  #!/usr/bin/python3

  import dbus
  import sys
  import threading

  from gi.repository import GLib

  from dbus.mainloop.glib import DBusGMainLoop
  #DBusGMainLoop(set_as_default=True)                                                                                                            

  if __name__ == "__main__":
      threading.Thread(target=GLib.MainLoop().run).start()

      for r in range(1000):
          print(".", flush=True, end="")
          dbus.SessionBus(private=True, mainloop=DBusGMainLoop())
          #dbus.SessionBus(private=True)                                                                                                         

      print("")
      sys.exit(0)


  $ ./test.py
  .............Segmentation fault

  
  It will also segfault if set_as_default is set to True, even without passing it to the SessionBus's mainloop parameter.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dbus-python/+bug/1890753/+subscriptions



More information about the foundations-bugs mailing list