-
Notifications
You must be signed in to change notification settings - Fork 2.1k
AspNetCore IO Exception Invalid Arguement #8299
Comments
Might be a dup of aspnet/aspnet-docker#288. Can you try the workaround suggested here - aspnet/aspnet-docker#288 (comment)? |
We dont have any AddJsonFile call in our config builder. |
What does your startup code look like? |
@SarthakSoni please provide us with a repro project so we can investigate this issue. |
|
@mkArtakMSFT: We are seeing this since we upgraded from NETCORE 2.0 to 2.1. We are trying to just start a simple MVC server with Kestrel as you can see in @SarthakSoni 's snippet. We are not hosting anything from the filesystem, why is ASP even setting up file system watchers? Is it using inotify? On what paths? This seems to be interfering with the paths owned by the widely used OMS agent on Linux. This means this fault is very likely to happen widespread on Azure Linux VMs. @SarthakSoni can you add an strace here? |
@SarthakSoni, can you also please share the |
|
@JunTaoLuo what would be the best way to avoid setting up config reload? @SarthakSoni \ @arunjvs you could have a look at your directory structure and see if there's something problematic there. |
I have seen similar issues with config reloading (for example https://github.com/aspnet/MetaPackages/issues/282). |
Thanks @pranavkm and @JunTaoLuo. We are moving to our own construction based on the default template. But I would really expect a default setting just to work. None of the parent or child directories of where our dotnet app is located has any special characters. IMO, the problem is different, we might be observing the whole root ( I'd guess a repro is a straight forward - create an Azure Linux VM (with Monitoring enabled) and |
An strace we did confirmed above - |
Hmm I'll need to try repro this to see which component is enumerating the files in the root directory. I would expect the default settings configured to watch the configuration files to only spawn file watchers from within the app directory.l |
@JunTaoLuo that's how the FileSystemWatcher is implemented on Linux - https://github.com/dotnet/corefx/blob/master/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs#L445-L450 |
@SarthakSoni @arunjvs , can you provide me with a repro app? From the pieces I've seen in the issue, the default setting should not be trying to enumerate the files under
|
You shouldn't need to make your own version of CreateDefaultBuilder, you can clean configuration providers if they are causing problems. public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration(builder =>
{
builder.Sources.Clear();
})
.UseStartup<Startup>(); @avertes Are you hosting your ASP.NET Core application at the root of your drive? |
@JunTaoLuo: 1 is not the case if you asking about the location of the assemblies (i.e. the publish output). But does it look at @davidfowl: I'd guess building it ourselves instead of undoing the defaults is cleaner anyway - we've realized there's lot of extra bloat in the default builder (in our project's context) that we don't need anyway. |
Maybe, I'd like to understand what bloat there is. We made it a point to make everything possible to undo, which also makes it possible to get additional features as they were added. You do have full control however and if you want to rewrite the method thats completely fine. |
@davidfowl We needed really less - a The primary reason we were using the default was indeed to automatically get additional features/improvements, plus that's what the docs also suggest. But because of this bug, we are constructing ourselves, and it appears to be a simpler and shorter code than undoing the defaults. The key point here is that a simple runtime upgrade broke the default from working correctly in our situation, so we doing it ourselves in these situations sounds safer in general, since those 'additional features' may not always work as expected. |
Sounds fine to me! |
Guys, is there any other pending action in here? |
Nope |
Is this a Bug or Feature request?:
Bug
Steps to reproduce (preferably a link to a GitHub repo with a repro project):
Microsoft.AspNetCore.Hosting
Description of the problem:
Getting IO Exception with invalid arguement in aspnet core.
at System.IO.Enumeration.FileSystemEnumerator
1.FindNextEntry() at System.IO.Enumeration.FileSystemEnumerator
1.MoveNext()at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName)
at System.IO.FileSystemWatcher.RunningInstance..ctor(FileSystemWatcher watcher, SafeFileHandle inotifyHandle, String directoryPath, Boolean includeSubdirectories, NotifyFilters notifyFilters, CancellationToken cancellationToken)
at System.IO.FileSystemWatcher.StartRaisingEvents()
at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()
at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
Version of
Microsoft.AspNetCore.Mvc
orMicrosoft.AspNetCore.App
orMicrosoft.AspNetCore.All
:2.1.1The text was updated successfully, but these errors were encountered: