Too Many Open Files

Hi All,

In our code we have used the writetofile service which is throwing the error
com.wm.app.b2b.server.ServiceException: IOException in CommonServices.utilities.fileIO:writeFile
Too many open files and creating the 0KB file which we are not able to delete. Please advise and do needfull help.

Thanks
Kumaar

Hi Kumar,

In relation to this error you are getting → writetofile service which is throwing the error com.wm.app.b2b.server.ServiceException: IOException in CommonServices.utilities.fileIO:writeFile Too many open files

Reason can be:

  • Once a file has been created and opened for manipulation, please make sure to close it when done.
    ** This is also true in Java IO - first open the file to work on and then save and close after.

If you are sure that the file has been closed after manipulation,

  • Do you have a loop or recursive calls in your codes? Or it could be that this service is called/referenced repeatedly by other service/s?

** You can put some debugLogs in between calls to your writeToFile for you to see how many times the code is executed.

If the above doesnt help, kindly provide me with a more detailed information.

  • By executing your codes, what exactly needs to happen?
  • If you can give the code fragment that’s throwing the Exception and the actual writeToFile related codes, it can give me a clue to better understand what’s going on.

Hope this helps.

Kind Regards,
Meann

You could also use PSUtilities.file:writeToFile or customize it to your needs and may be in the flow which invokes this writeFile service was not handled properly or IO close operation not working as expected and unable to complete/stuck writing the data to the opened file.

HTH,
RMG