-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Frequent IOException
s using MVC with Core CLR on Linux
#3066
Comments
Likely we could work around this issue by caching These problems should not occur in a real application because the Separately I'm trying to see what resource we're actually exhausting... |
We also tend to create a new 'server' per testcase. We could probably speed up these tests a few seconds by not doing that. |
- #3066 - cache `HostingEnvironment` instances per application root - avoid creating a system-limited `FileSystemWatcher` per test
If users do functional testing of MVC behaviours, they may benefit from the more-specific error messages @stephentoub added in dotnet/corefx#3060. Testing a PR to avoid |
…al tests - #3066 - cache `TestServer` instances per site / configuration delegate - works around `inotify` limits with Core CLR on Linux - `PhysicalFileProvider` instances created in `IHostingEnvironment.Initialize()`, `RazorViewEngineOptionsSetup.ConfigureRazor()`, `RazorPreCompileModule.BeforeCompile()`, and a `MvcRazorHost` constructor that is called only from tooling - `IHostingEnvironment.Initialize()` called in `TestHelper.AddTestServices()` and `WebHostBuilder.Build()` i.e. the `TestServer` constructor
…al tests - #3066 - cache `TestServer` instances per site / configuration delegate - works around `inotify` limits with Core CLR on Linux - `PhysicalFileProvider` instances are created in `IHostingEnvironment.Initialize()`, `RazorViewEngineOptionsSetup.ConfigureRazor()`, `RazorPreCompileModule.BeforeCompile()`, and a `MvcRazorHost` constructor that is called only from tooling - `IHostingEnvironment.Initialize()` called in `TestHelper.AddTestServices()` and `WebHostBuilder.Build()` i.e. the `TestServer` constructor - now create ~70 `TestServers` for the 51 sites we test - side benefit: xUnit reports functional tests execute for ~14.5s; was ~31.4s before this change
…al tests - #3066 - cache `TestServer` instances per site / configuration delegate - works around `inotify` limits with Core CLR on Linux - `PhysicalFileProvider` instances are created in `IHostingEnvironment.Initialize()`, `RazorViewEngineOptionsSetup.ConfigureRazor()`, `RazorPreCompileModule.BeforeCompile()`, and a `MvcRazorHost` constructor that is called only from tooling - `IHostingEnvironment.Initialize()` called in `TestHelper.AddTestServices()` and `WebHostBuilder.Build()` i.e. the `TestServer` constructor - now create ~70 `TestServers` for the 51 sites we test - side benefit: xUnit reports functional tests execute for ~14.5s; was ~31.4s before this change
…al tests - #3066 - cache `TestServer` instances per site / configuration delegate - add new `TestHelper.GetOrCreateServer()` methods that use new cache - switch tests from `CreateServer()` to `GetOrCreateServer()` except in a few special cases - special cases likely test issues though `WebApiCompatShimBasicTest` ones may indicate an underlying bug - work around `inotify` limits with Core CLR on Linux - FYI `PhysicalFileProvider` instances are created in `IHostingEnvironment.Initialize()`, `RazorViewEngineOptionsSetup.ConfigureRazor()`, `RazorPreCompileModule.BeforeCompile()`, and a `MvcRazorHost` constructor that is called only from tooling - `IHostingEnvironment.Initialize()` called in `TestHelper.AddTestServices()` and `WebHostBuilder.Build()` i.e. the `TestServer` constructor - now create ~75 `TestServers` for the 51 sites we test - side benefit: xUnit reports functional tests execute for ~14.5s; was ~31.4s before this change
…al tests - #3066 - cache `TestServer` instances per site / configuration delegate - add new `TestHelper.GetOrCreateServer()` methods that use new cache - switch tests from `CreateServer()` to `GetOrCreateServer()` except in a few special cases - special cases likely test issues though `WebApiCompatShimBasicTest` ones may indicate an underlying bug - work around `inotify` limits with Core CLR on Linux - FYI `PhysicalFileProvider` instances are created in `IHostingEnvironment.Initialize()`, `RazorViewEngineOptionsSetup.ConfigureRazor()`, `RazorPreCompileModule.BeforeCompile()`, and a `MvcRazorHost` constructor that is called only from tooling - `IHostingEnvironment.Initialize()` called in `TestHelper.AddTestServices()` and `WebHostBuilder.Build()` i.e. the `TestServer` constructor - now create ~75 `TestServers` for the 51 sites we test - side benefit: xUnit reports functional tests execute for ~14.5s; was ~31.4s before this change
…al tests - #3066 - cache `TestServer` instances per site / configuration delegate - add new `TestHelper.GetOrCreateServer()` methods that use new cache - switch tests from `CreateServer()` to `GetOrCreateServer()` except in a few special cases - special cases likely test issues though `WebApiCompatShimBasicTest` ones may indicate an underlying bug - work around `inotify` limits with Core CLR on Linux - FYI `PhysicalFileProvider` instances are created in `IHostingEnvironment.Initialize()`, `RazorViewEngineOptionsSetup.ConfigureRazor()`, `RazorPreCompileModule.BeforeCompile()`, and a `MvcRazorHost` constructor that is called only from tooling - `IHostingEnvironment.Initialize()` called in `TestHelper.AddTestServices()` and `WebHostBuilder.Build()` i.e. the `TestServer` constructor - now create ~75 `TestServers` for the 51 sites we test - side benefit: xUnit reports functional tests execute for ~14.5s; was ~31.4s before this change
…al tests - #3066 - cache `TestServer` instances per site / configuration delegate - add new `TestHelper.GetOrCreateServer()` methods that use new cache - switch tests from `CreateServer()` to `GetOrCreateServer()` except in a few special cases - special cases likely test issues though `WebApiCompatShimBasicTest` ones may indicate an underlying bug - work around `inotify` limits with Core CLR on Linux - FYI `PhysicalFileProvider` instances are created in `IHostingEnvironment.Initialize()`, `RazorViewEngineOptionsSetup.ConfigureRazor()`, `RazorPreCompileModule.BeforeCompile()`, and a `MvcRazorHost` constructor that is called only from tooling - `IHostingEnvironment.Initialize()` called in `TestHelper.AddTestServices()` and `WebHostBuilder.Build()` i.e. the `TestServer` constructor - now create ~75 `TestServers` for the 51 sites we test - side benefit: xUnit reports functional tests execute for ~14.5s; was ~31.4s before this change
Details on the
|
…al tests - #3066 - cache `TestServer` instances per site / configuration delegate - work around `inotify` limits with Core CLR on Linux - add new `TestHelper.GetOrCreateServer()` methods that use new cache - switch tests from `CreateServer()` to `GetOrCreateServer()` except in a few special cases - e.g. where context services are referenced in tests - FYI `PhysicalFileProvider` instances are created in `IHostingEnvironment.Initialize()`, `RazorViewEngineOptionsSetup.ConfigureRazor()`, `RazorPreCompileModule.BeforeCompile()`, and a `MvcRazorHost` constructor that is called only from tooling - `IHostingEnvironment.Initialize()` called in `TestHelper.AddTestServices()` and `WebHostBuilder.Build()` i.e. the `TestServer` constructor - now create ~70 `TestServers` for the 51 sites we test - side benefit: xUnit reports functional tests execute for ~14.5s; was ~31.4s before this change
- #3066 - reduce `TestServer` -> `PhysicalFileProvider` -> `FileSystemWatcher` count enough to run with Core CLR on Linux - remove use of `HttpClient.DefaultRequestHeaders`; any client change affects other tests - remove use of `RequestBuilder` class; creates a per-test `HttpClient` and requires the `TestServer` - updated a few expectations because `CommonTestEncoder` does JavaScript a bit differently - "JavaScriptEncode[[...]]" -> "JavaScriptStringEncode[[...]]" - side benefit: xUnit reports functional tests execute for only ~12.4s; was >30s before this change Infrastructure: Enhance `MvcTestFixture` - handle `ConfigureServices()` methods that are not `void` - handle `Configure(IApplicationBuilder, ILoggerFactory)` - ensure server is initialized with consistent `CurrentCulture` and `CurrentUICulture` - add `FilteredDefaultAssemblyProviderFixture<TStartup>` and `MvcEncodedTestFixture<TStartup>` - add `MvcTextFixture.AddAdditionalServices()` extension point supporting these - do not expose the `TestServer`; an anti-pattern for tests to manipulate the server - update class names to match containing files - use existing `TestApplicationEnvironment` - apply some `MvcTestFixture` improvements to the shared `TestApplicationEnvironment` class - remove unused methods from `TestHelper` nits: - touched-up some leftover `_app` &c declarations to be more explicit and minimize `using`s - moved statements into correct sections of methods in `RoutingTests` - removed `TestLoggerFactory` and related classes from `TagHelperSampleTest`
Functional tests on Linux often fail due to
IOException
s. I currently see 97 test failures inTest/Microsoft.AspNet.Mvc.FunctionalTests
and 78IOException
s in the output.The root cause may be an external issue but should start with confirming we're using
PhysicalFilesWatcher
s efficiently (given the number of files in the repo). Or perhaps this is a known system issue we should work around when testing on Linux (similar to settingMONO_THREADS_PER_CPU
).Example stack traces (think this covers all 78
IOException
s):FYI I reconfigured the system to bump up the
ulimit -n
number from 1024 to 10240 (see this answer). This had minimal impact.The text was updated successfully, but these errors were encountered: