Last post Jun 22, 2019 11:51 AM by PatriceSc
Jun 21, 2019 04:29 PM|fergus_aspnet|LINK
I know it is bad practice to run code like the following regularly in an application, however it does seem to leave files open.
Therefore if it is run in a controller method there will be a "Too many open file handles ' error after several hundred requests/.
Is it to be expected that the configuration file will not be closed within the scope of the method that uses it ??
Jun 21, 2019 04:58 PM|PatriceSc|LINK
I suspect this is caused by reloadOnChange: true (which uses likely a file watcher, and if I follow the doc I do see that the returned object is disposable).
Try maybe false to see if it changes something (even if this is not what you want ???) or try to dispose this object ???
Actually, I'm really not sure to get what is the purpose of doing that from your controller ? You are trying precisely to reload explicitly your settings this way???
Jun 21, 2019 05:13 PM|fergus_aspnet|LINK
Thanks for the quick response. The code was bad, but I was exploring the side effect of the fact that it was leaving the file open. I will try changing to false.
Jun 22, 2019 11:51 AM|PatriceSc|LINK
Still unclear. if you have this in your controller to test what happens when calling that once at startup don't base your decision on that :
- if you want to be able to edit the settings file and have this be taken into account leave that (and more likely the file is not left open but you consume a file system handle used by a mechanism used to handle changes in this directory)
- if not needed you can disable that and you'll save just more or less a single handle