UnauthorizedAccessException thrown when accessing http raft node state
See original GitHub issueWhat happens?
An UnauthorizedAccessException
is thrown when restarting an http raft node with persistence enabled.
What is expected?
The http raft node starts without throwing exception
Configuration:
Here’s the relevent content of my appsettings.json
file:
{
"Partitioning": false,
"LowerElectionTimeout": 150,
"UpperElectionTimeout": 300,
"RequestTimeout": "00:10:00",
"ColdStart": false,
"RequestJournal": {
"MemoryLimit": 5,
"Expiration": "00:01:00"
}
}
Here’s my Program.cs
file:
var builder = WebApplication.CreateBuilder(args);
var port = int.Parse(args[0]);
if (args.Length > 1)
builder.Configuration["ContactNode"] = $"http://localhost:{int.Parse(args[1])}";
builder.Configuration["PublicEndPoint"] = $"http://localhost:{port}";
builder.Configuration["LocalNode"] = $"http://localhost:{port}";
builder.WebHost.ConfigureKestrel(kestrel =>
{
kestrel.ListenLocalhost(port);
});
builder.Services.UsePersistentConfigurationStorage(Path.Combine(port.ToString(), "config"));
builder.Services.UsePersistenceEngine<IClusterStateMachine, ClusterStateMachine>();
builder.Services.AddSingleton<IPeerLifetime, PeerLifetime>();
builder.Services.Configure<ClusterStateMachineOptions>(options => Path.Combine(port.ToString(), "state"));
builder.JoinCluster();
builder.JoinMesh();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
app.UseExceptionHandler("/error");
app.UseStaticFiles();
app.UseConsensusProtocolHandler();
app.UseHyParViewProtocolHandler();
app.UseRouting();
Any idea of why I’m facing this issue? Thanks in advance and big up for your amazing project!
Issue Analytics
- State:
- Created a year ago
- Comments:10
Top Results From Across the Web
c# - Why is access to the path denied?
According to File.Delete Method... An UnauthorizedAccessException means one of 4 things: The caller does not have the required permission.
Read more >UnauthorizedAccessException Class (System)
The exception that is thrown when the operating system denies access because of an I/O error or a specific type of security error....
Read more >Debugging System.UnauthorizedAccessException
UnauthorizedAccessException contains no additional status or error code property so that you can figure out what is going on.
Read more >[Solved] System.UnauthorizedAccessException
UnauthorizedAccessException : Access to the path 'C:\Program Files\...\Prison Alarm Manager\Errors\' is denied. Iknow the error is coming from ...
Read more >Access to path is denied - Help
Message: Access to the path 'C:\Users\xxxxxx.xxxxxx\Desktop\Samsung\Working Copies' is denied. Exception Type: UnauthorizedAccessException.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Anyway, you should not use HyParView for member discovery especially in combination with Raft. HyParView is a membership protocol for Gossip-based messaging with weak consistency of cluster in contrast to Raft membership protocol with strong consistency. HyParView and Raft are orthogonal things for different purposes.
@sakno I’ll provide the traces tomorrow (in bed right now), but it’s not related to hosting, it’s an IO issue. At first launch, the state folder is created and works as expected. Restarting the app without removing said folder throws the exception after attempting to write to the 0 file. Now that I think of it, it might occur because the faulted node is systematically starting with the boostrap flag set to true, but I need to verify that theory.