-
Notifications
You must be signed in to change notification settings - Fork 733
Closed
Labels
area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Description
This can be seen when running playground/AspireEventHub/EventHubs.AppHost, and the dashboard shows the eventhubns having crashed with:
Unhandled exception. System.UnauthorizedAccessException: Access to the path '/Eventhubs_Emulator/ConfigFiles/Config.json' is denied.
---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.<Load>g__OpenRead|6_0(IFileInfo fileInfo)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Microsoft.Extensions.Hosting.HostBuilder.InitializeAppConfiguration()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at a.a.aaR.A(String[])
at a.a.aaR.<Main>(String[])
I was able to reproduce this in a test in Aspire.Hosting.Azure.Tests with:
{
using var builder = TestDistributedApplicationBuilder.Create().WithTestAndResourceLogging(testOutput);
var blob = builder.AddAzureStorage("ehstorage")
.RunAsEmulator()
.AddBlobs("checkpoints");
var eventHubs = builder.AddAzureEventHubs("eh").RunAsEmulator().AddEventHub("hub");
using var app = builder.Build();
CancellationTokenSource cts = new();
var t = app.RunAsync();
var hb = Host.CreateApplicationBuilder();
hb.AddAzureEventHubConsumerClient("eventhubns", settings =>
{
settings.EventHubName = "hub";
});
using var host = hb.Build();
var t2 = host.RunAsync();
await Task.Delay(500_000);
await app.StopAsync();
}Here the file is created by aspire:
aspire/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs
Lines 145 to 150 in c31eaf3
| .WithAnnotation(new ContainerMountAnnotation( | |
| Path.GetTempFileName(), | |
| AzureEventHubsEmulatorResource.EmulatorConfigJsonPath, | |
| ContainerMountType.BindMount, | |
| isReadOnly: false)); | |
aspire/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs
Lines 187 to 191 in c31eaf3
| var configFileMount = emulatorResource.Annotations.OfType<ContainerMountAnnotation>().Single(v => v.Target == AzureEventHubsEmulatorResource.EmulatorConfigJsonPath); | |
| using var stream = new FileStream(configFileMount.Source!, FileMode.Create); | |
| using var writer = new Utf8JsonWriter(stream); | |
cc @eerhardt @sebastienros another one of the file permissions in container when running from a Linux host.
Metadata
Metadata
Assignees
Labels
area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication