question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UnauthorizedAccessException thrown when accessing http raft node state

See original GitHub issue

What 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:closed
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
saknocommented, May 6, 2022

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.

1reaction
cdavernascommented, May 5, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found