igraph for python 2.7 not closing files after read

Bug #1090566 reported by yaniv.m.david
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
igraph
Fix Released
High
Tamás Nepusz

Bug Description

running this code:

l = list()
for graphName in os.listdir(graphsDir):
      l.append(Graph.read(graphname))

when graphsdir has ~256 files will result in "Python: IOError: [Errno 24] Too many open files" in python 2.7, but not for python 2.6

im guessing the 2.7 version doesnt close the files after reading for some reason?

Revision history for this message
Tamás Nepusz (ntamas) wrote :

Thanks, will check soon. Could be a reference leak or something like that.

Changed in igraph:
importance: Undecided → High
assignee: nobody → Tamás Nepusz (ntamas)
milestone: none → 0.6.1
Revision history for this message
Tamás Nepusz (ntamas) wrote :

Could not reproduce the issue yet; tried on Mac OS X 10.8.2 and on a 64-bit Linux machine, both equipped with Python 2.7.

What platform are you using? Is it a 64-bit or a 32-bit machine? What is the exact Python and igraph version? What graph format are you trying to load?

Changed in igraph:
status: New → Incomplete
Revision history for this message
yaniv.m.david (yaniv-m-david) wrote :

python 2.6.6 and 2.7.3. (both 32bit)
64bit machine, windows 7 64bit
gml format (exported from igraph using python 2.6)

Revision history for this message
yaniv.m.david (yaniv-m-david) wrote :

and - igraph 0.6 (from msi downloaded from the main site)

Revision history for this message
Tamás Nepusz (ntamas) wrote :

Platform-specific issue; seems to happen on Windows only. (Managed to reproduce it on a 32-bit Windows machine). FWIW, it does not happen on Mac OS X even if I lower the maximum number of file handles per process, so it seems like the problem lies not within igraph but maybe in Python itself. I'll keep on digging.

Changed in igraph:
status: Incomplete → Confirmed
Revision history for this message
Tamás Nepusz (ntamas) wrote :

Alternatively, it could be the case that it is igraph's fault but I've fixed it already and that's why I don't see the error on my machine ;) I remember that I played around a bit with that part of the code recently. I will try to compile the current head of the 0.6 branch on a Windows machne and check if I still get the issue.

Revision history for this message
Tamás Nepusz (ntamas) wrote :

Apparently, this issue is already fixed in the most recent revision of the 0.6 branch. Please send me a private message via Launchpad (from my profile page) if you need an msi installer for a development snapshot of python-igraph for Python 2.7 so you can test it yourself.

Changed in igraph:
status: Confirmed → Fix Committed
Changed in igraph:
status: Fix Committed → Fix Released
Revision history for this message
Gábor Csárdi (gabor.csardi) wrote : Continue on github

The development of igraph has moved to github, so please do not comment on this bug here. You are of course welcome to comment on github, here:
https://github.com/igraph/igraph/issues/126

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.