-
-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Hi,
I've been using this (great) library for a while but ever since I switched to deploying my applications to Debian I've started running into issues with weird errors where after a while, I hit the inotify instance limit
set by my webserver.
The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached.
After some digging, I noticed that this is a problem in core ASP.NET aswell, specifically when adding the AppSettings.json to your app configuration on startup:
dotnet/AspNetCore.Docs#19814
I've managed to track the root cause of this down to this library, specifically the JsonResourceManager. Every time I hit an API endpoint which would return a localized json resource string using this library, a new inotify watch instance
seems to be created. These instances are not disposed until I manually restart my application.
The JsonResourceManager seems to be using the same reloadOnChange
functionality here:
https://github.com/hishamco/My.Extensions.Localization.Json/blob/dev/src/My.Extensions.Localization.Json/Internal/JsonResourceManager.cs#L181
Which in my opinion, should really only be enabled when developing locally - after deployment the resource files should generally not change.
After forking this library and changing reloadOnChange: true
to reloadOnChange: false
, I've confirmed that this fixes the problem with endless inotify instances
being created without being disposed.
Relevant issue in ASP.NET repository:
dotnet/runtime#27272
dotnet/runtime#37664
dotnet/runtime#62869