graphite-project / ceres

Distributable time-series database (not actively maintained)
Apache License 2.0
355 stars 77 forks source link

Free open file handled explicitly #33

Closed ibuclaw closed 8 years ago

ibuclaw commented 9 years ago

Something happened™ that made me look at the rollup script we use in production. I turned off async workers so that this simple loop was being done on the database:

for current_dir, subdirs, files in os.walk(root):
  for subdir in subdirs:
    if subdir == '.ceres-tree':
      continue
    path = join(current_dir, subdir)
    if os.listdir(path):
      if exists(join(path, '.ceres-node')):
        node_found(path, root, rollup_time)  # calls slice.read(from, to)
        nodes_found += 1

And after 1 minute or so, it error'd with:

Traceback (most recent call last):
  File "<builtin>/app_main.py", line 75, in run_toplevel
  File "rollup.py", line 108, in <module>
  File "rollup_simple.py", line 137, in node_found
  File "ceres.py", line 360, in slices
  File "ceres.py", line 389, in readSlices
OSError: [Errno 24] Too many open files

Where the failed line is calling os.listdir(self.fsPath)

With these two changes, this no longer became reproducible.

ibuclaw commented 8 years ago

Closing as repository no longer exists. (Reopened as #41)