Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable file watcher - The configured user limit (128) on the number of inotify instances has been reached #1562

Open
EtienneBruines opened this issue Oct 7, 2024 · 3 comments

Comments

@EtienneBruines
Copy link

EtienneBruines commented Oct 7, 2024

Follow-up on #1200

We are running short-lived smtp4dev instances in a container environment in our CI tests. Sometimes starting smtp4dev does not work. Logs:

2024-10-07T03:16:57.219584091Z smtp4dev version 3.6.1+5e577a8b4152ceb7276a5b8d4432430c9ff9055d
2024-10-07T03:16:57.220143267Z https://github.com/rnwood/smtp4dev
2024-10-07T03:16:57.220293099Z .NET Core runtime version: .NET 8.0.4
2024-10-07T03:16:57.225646355Z 
2024-10-07T03:16:57.225666483Z  > For help use argument --help
2024-10-07T03:16:57.225669889Z 
2024-10-07T03:16:57.226773483Z Install location: /
2024-10-07T03:16:57.277489530Z DataDir: /smtp4dev
2024-10-07T03:16:57.288689842Z Default settings file: /app/appsettings.json
2024-10-07T03:16:57.288833213Z User settings file: /smtp4dev/appsettings.json
2024-10-07T03:16:57.299728290Z A unhandled exception occurred.
2024-10-07T03:16:57.299752536Z 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.
2024-10-07T03:16:57.299758367Z    at System.IO.FileSystemWatcher.StartRaisingEvents()
2024-10-07T03:16:57.299761833Z    at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
2024-10-07T03:16:57.299765680Z    at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
2024-10-07T03:16:57.299769027Z    at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration`1..ctor(Func`1 changeTokenProducer, Action`1 changeTokenConsumer, TState state)
2024-10-07T03:16:57.299771792Z    at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
2024-10-07T03:16:57.299774417Z    at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
2024-10-07T03:16:57.299777683Z    at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
2024-10-07T03:16:57.299780969Z    at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
2024-10-07T03:16:57.299783945Z    at Rnwood.Smtp4dev.Program.<>c__DisplayClass8_0.<BuildWebHost>b__0(HostBuilderContext hostingContext, IConfigurationBuilder configBuilder) in /home/vsts/work/1/s/Rnwood.Smtp4dev/Program.cs:line 175
2024-10-07T03:16:57.299788323Z    at Microsoft.Extensions.Hosting.HostBuilder.InitializeAppConfiguration()
2024-10-07T03:16:57.299792000Z    at Microsoft.Extensions.Hosting.HostBuilder.Build()
2024-10-07T03:16:57.299795537Z    at Rnwood.Smtp4dev.Program.BuildWebHost(String[] args, CommandLineOptions cmdLineOptions, MapOptions`1 commandLineOptions) in /home/vsts/work/1/s/Rnwood.Smtp4dev/Program.cs:line 222
2024-10-07T03:16:57.299798803Z    at Rnwood.Smtp4dev.Program.StartApp(IEnumerable`1 args, Boolean isDesktopApp, Action`1 fixedOptions) in /home/vsts/work/1/s/Rnwood.Smtp4dev/Program.cs:line 104
2024-10-07T03:16:57.299802460Z    at Rnwood.Smtp4dev.Program.Main(String[] args) in /home/vsts/work/1/s/Rnwood.Smtp4dev/Program.cs:line 44

The issue is here:

.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);

Is there any way we can configure this reloadOnChange: true via environment variables? To set this to false? There is no need for file watchers in automated tests.

(Ideally this would also apply to the user config files a few lines later.)

Thanks!

@rnwood
Copy link
Owner

rnwood commented Oct 17, 2024

Related issue:
dotnet/dotnet-docker#3546

@rnwood
Copy link
Owner

rnwood commented Oct 17, 2024

PR #1564 created. This turns off the use of inotify for the Linux container images.

This needs some wider testing before merging.
Feedback invited from everyone. You can pull down the tag from the PR to test.

@rnwood
Copy link
Owner

rnwood commented Oct 17, 2024

Docker hub tag is: 3.7.0-ci20241017100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants