gtk_main leaks a file descriptor every time the main loop is run if threads have been initialized
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PyGTK |
Fix Released
|
Medium
|
|||
pygobject |
Fix Released
|
Medium
|
|||
gtk+2.0 (Ubuntu) |
Invalid
|
Low
|
Ubuntu Desktop Bugs | ||
pygobject (Ubuntu) |
Invalid
|
Low
|
Unassigned | ||
pygtk (Ubuntu) |
Fix Released
|
Low
|
Ubuntu Desktop Bugs |
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:
tick = 0
while tick < iterations:
tick += 1
if (tick % 1000) == 0:
print 'Tick', tick
lasttag = timeout_add(1, main_quit)
main()
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.
Changed in pygtk: | |
status: | Unknown → New |
Changed in pygtk (Ubuntu): | |
assignee: | nobody → Ubuntu Desktop Bugs (desktop-bugs) |
importance: | Undecided → Low |
status: | New → Triaged |
Changed in pygtk: | |
status: | New → Fix Released |
Changed in pygobject: | |
importance: | Undecided → Unknown |
status: | New → Unknown |
Changed in pygobject: | |
importance: | Unknown → Medium |
status: | Unknown → Fix Released |
Changed in pygtk: | |
importance: | Unknown → Medium |
Changed in pygobject (Ubuntu): | |
status: | Triaged → Invalid |
thank you for your bug report, is that specific to pygtk or do you have it also in C GTK? the issue is an upstream one and should be open on bugzilla.gnome.org when the people writting pygtk or gtk will read it