This forum is shutting down! Please post new discussions at

solving "[Errno 24] Too many open files" when running RIOS IPA

fredjhoffmannfredjhoffmann Member
edited October 2014 in RIOS
Hello all,

When running the RIOS IPA for water control for drinking water and N retention objectives, I keep getting error: "[Errno 24] Too many open files" which causes the process to stop. Has anyone else encountered this? does anyone know how to get around this error? the log (attached) says that the exception is not disk-space related.

thanks in advance for the help!


  • jdouglassjdouglass Administrator, NatCap Staff

    Thanks for including your logfile! It helps a ton in debugging.

    As a general note about these sorts of errors, Windows has a hard limit to the number of files that it can have open at any given time. According to this MSDN post, it looks like the limit is 512 open files. The RIOS lead developer and I checked out this error and it looks like we use temporary files as part of the sorting process, where the number of temporary files grows with the number of rows in the raster to be sorted.

    If there's any chance that you have any open programs with lots of open files (I don't know about you, but I typically have a ton of files open in my GIS windows :) ), I'd try closing them down and re-running RIOS. If that still fails, I think the only workaround at the moment would be to scale your LULC to a coarser resolution.

    Let us know how this goes for you!
  • Hi JDouglass,

    Thanks for the feedback. I was running RIOS by itself but was running it on a mac through parallels and I think it was all too much for it to handle. Ended up losing my virtual hard drive and a few weeks of work. I've now assigned more memory to my vm and it's working smoother.

    RIOS still encounters an Exception when running (after about 15mins), here's the error message. Not sure what this means, perhaps you've seen it before?

    10/30/2014 11:12:13 IPA DEBUG activity_name watersystem_reconstruction allowed lu codes: set([33, 2, 35, 5, 12, 47, 16, 21, 26, 37])
    10/30/2014 11:12:33 IPA INFO sort the prefer/prevent/activity score to disk
    10/30/2014 11:14:05 root ERROR ---------------------------------------------------
    10/30/2014 11:14:05 root ERROR ---------------------- ERROR ----------------------
    10/30/2014 11:14:05 root ERROR ---------------------------------------------------
    10/30/2014 11:14:05 root ERROR Error: exception found while running rios
    10/30/2014 11:14:05 root DEBUG
    10/30/2014 11:14:05 root DEBUG Printing traceback
    Traceback (most recent call last):
    File "invest_natcap\iui\executor.pyc", line 378, in run
    File "invest_natcap\iui\executor.pyc", line 532, in runModel
    File "invest_natcap\iui\ex
    Thanks for the help,
  • jdouglassjdouglass Administrator, NatCap Staff
    Hi Fred,

    That's rough ... I'm sorry you lost your virtual hard drive, but I'm glad it's running smoother with more memory.

    It looks like perhaps the traceback was cut off ... is there any chance you could try reposting the full traceback or else attach the logfile from the run?

  • It happens...

    Anyway, here's the log!

    thanks for the help
  • jdouglassjdouglass Administrator, NatCap Staff
    That's so odd that the log file cuts off in the middle of the traceback ... Do you remember if it broke on the same line as in your earlier log?
  • jdouglassjdouglass Administrator, NatCap Staff
    Hi again ... have you had any luck with this?
    Did downsampling your lulc influence anything?
    If not, is there any chance that you could attach a recent log? I'm hoping to get the full traceback to see if the issue is in the same place.

  • Hi Jdouglass,
    Thanks for checking in again. Seems like I'm still getting an exception, attached is the most recent log. It's not the same exception, and strangely the log isn't complete (or at least the printed traceback seems cut). I think it ran all the way through though, because I got a decent amount of results. Is it possible that this is just the way RIOS stops running once it is complete?
  • RichRich Administrator, NatCap Staff
    Hi Fred, I bet by now it would seem reasonable that RIOS should complete its final step by crashing but really if everything works it will terminate normally. When the crash happens there will be a little red box on the execution window with the specific exception. Is there anyway you can screenshot that and send it to us since your log terminates early?
  • Hi Rich,

    here's a screenshot of the most recent attempt and it's log... seems like the error type is "none"?

    excited to see this terminate normally someday!
  • RichRich Administrator, NatCap Staff
    Hi Fred, thanks for the screenshot. The error you're experiencing is with some of our versioning framework that shouldn't be an issue in the released version of RIOS, more like something I'd expect in a development tip. But one of our problems with rios is it doesn't automatically version like InVEST does, so there's a chance your 1.0.0b10 is actually a different 1.0.0b10 that's available on our main download page:

    There could also be an old caching issue that might come up if you had run RIOS on an earlier version in the past. So two things to try: first, can you go to the file menu in rios an click on "clear cached runs", then quit RIOS, relaunch it, and try to run it again? Be aware this will delete your input parameters (sorry) so you may want to make sure you have those recorded somewhere first.

    Then if that doesn't work, I suspect you have some off version of RIOS, so I'd recommend first uninstalling whatever you have now, then downloading the current version from the website link above, launching the new version, clearing the cached runs like before, quitting it, THEN relaunch and try another run.

    Sorry that's so complicated, but I think it'll fix your issue.
  • Thanks for answering on a saturday!

    I hate to say this but... neither of those worked! still getting the exact same message after clearing cache, quitting and restarting and after uninstalling, re-downloading and reinstalling...
  • ok I'm still getting everything BUT the last activity_total.tif output in activity_scores - is there a way I can manually calculate this from each individual activity score i am getting?
  • RichRich Administrator, NatCap Staff
    Hi Fred, I chatted w/ James about this, we wonder if there's actually another error that's happening right before that causes an unrelated versioning error. You can kinda see it in the black window on your screenshot "ERROR 1: something ... something". I'm gonna guess there's an issue with your data stack. I'm pretty swamped, but I'll offer that you could dropbox me your data stack along with a saved version of your RIOS parameter file (with the RIOS UI filled all out, go to File -> Save Parameters") and attach that file along w/ the stack; that'll let me fill out the UI without manually setting those hundreds of input parameters.

    Easiest way to get large amount of data to me is to dropbox to my stanford account

    Otherwise, I'd kinda wonder if there's a data overlap issue, maybe one of the input rasters in a different projection, or doesn't overlap other data?

    Sorry for the delay...
  • Hi Rich,
    thanks for the reply and kind offer. I double checked projections and they are all in WGS84 UTM 50N. Here's a link to the dropbox file with the data and parameters.

  • RichRich Administrator, NatCap Staff
    Hi Fred, sorry for the delay I still haven't gotten to this, but I also havent' forgotten. I'm scrambling to get an InVEST release out so I hope to have time soon to look at it.
Sign In or Register to comment.