← Back to team overview

desktop-packages team mailing list archive

[Bug 363245] Re: gtk_main leaks a file descriptor every time the main loop is run if threads have been initialized

 

** Changed in: pygobject (Ubuntu)
       Status: Triaged => Invalid

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to pygobject in Ubuntu.
https://bugs.launchpad.net/bugs/363245

Title:
  gtk_main leaks a file descriptor every time the main loop is run if
  threads have been initialized

Status in Python bindings for GObject:
  Fix Released
Status in PyGTK: GTK+ for Python:
  Fix Released
Status in “gtk+2.0” package in Ubuntu:
  Invalid
Status in “pygobject” package in Ubuntu:
  Invalid
Status in “pygtk” package in Ubuntu:
  Fix Released

Bug description:
  Here is a Python script, using pygtk, which demonstrates the problem.

  from gtk import main, main_quit
  from gobject import threads_init, timeout_add, source_remove
  import sys

  def test(iterations, use_threads):
      if use_threads:
          threads_init()
      tick = 0
      while tick < iterations:
          tick += 1
          if (tick % 1000) == 0:
              print 'Tick', tick
          lasttag = timeout_add(1, main_quit)
          main()
          source_remove(lasttag)

  if __name__ == "__main__":
      if sys.argv[1:] == ['no-threads']:
          threads = False
      else:
          threads = True
      print 'Using threads:', threads
      test(10000, threads)
      print 'Done.'

  When run on Jaunty or Intrepid, this is the output:

  $ python gtkrash.py 
  Using threads: True

  ** ERROR **: Cannot create main loop pipe: Too many open files

  aborting...
  Aborted
  $ python gtkrash.py no-threads
  Using threads: False
  Tick 1000
  Tick 2000
  Tick 3000
  Tick 4000
  Tick 5000
  Tick 6000
  Tick 7000
  Tick 8000
  Tick 9000
  Tick 10000
  Done.
  $ 

  When run on Hardy, however, the test is successful regardless of
  whether threads are used.

To manage notifications about this bug go to:
https://bugs.launchpad.net/pygobject/+bug/363245/+subscriptions