dotnet / dotnet/aspnetcore

disable FileWatching for FileVersionProvider/Default IFileProvider

Open
#42,070 6 comments 2 reactions 0 assignees View on GitHub
area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

currently when running production under docker or under kubernetes we sometimes run into:

```
System.IO.IOException: 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.
at System.IO.FileSystemWatcher.StartRaisingEvents()
at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
at Microsoft.AspNetCore.Mvc.Razor.Infrastructure.DefaultFileVersionProvider.AddFileVersionToPath(PathString requestPathBase, String path)
```

the problem is that we use `asp-append-version` which actually triggers a file watcher, since it calls `FileProvider.Watch`.

### Describe the solution you'd like

However in production this is not really that cool, since it can quickly exhaust all inodes. Thus it would be great if it would be possible to disable the file watching in production completly, the same thing that can be done for configuration files via the following: https://docs.microsoft.com/de-de/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-6.0#disable-app-configuration-reload-on-change

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.