PySCIPOpt icon indicating copy to clipboard operation
PySCIPOpt copied to clipboard

writing several .sol/.lp/.log to file within loop leads to -> ERROR: cannot create file .... Too many open files

Open JPelda opened this issue 4 years ago • 3 comments

File "src\pyscipopt\scip.pyx", line 1387, in pyscipopt.scip.Model.writeProblem File "src\pyscipopt\scip.pyx", line 239, in pyscipopt.scip.PY_SCIP_CALL OSError: SCIP: cannot create file!

I found in a forum that I would have to change the allowed maximum of simulatiously opened files. However, it might be better to close opened files after writing to them anyway. The error happens after writing 83 .sol files but my simulation is going to produce 8759 of those solution files. Any idea to get this working?

I appreciate any help! And thank you very much for your work on pyscipopt!

Best Johannes

JPelda avatar Nov 14 '21 19:11 JPelda

With new version pyscipopt 3.4 it seems to work although the windows explorer stops working. Closing file descriptor is a good choice!

JPelda avatar Nov 17 '21 13:11 JPelda

line 70, in <module>
    scip.writeStatistics()
  File "src/pyscipopt/scip.pyx", line 4612, in pyscipopt.scip.Model.writeStatistics
OSError: [Errno 9] Bad file descriptor

model.writeStatistics() is failing - seems to be introduced by #543, ideas @mattmilten ?

CGraczyk avatar Feb 16 '22 11:02 CGraczyk

I honestly don't know how to resolve that issue. On the one hand, we cannot close the file explicitly (see #570), still there are apparently some dangling file descriptors flying around.

mattmilten avatar Mar 26 '22 12:03 mattmilten