Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Akka.DistributedData.LightningDb: move durable folder creation outside of actor constructor in order to preserve stack trace / provide clearer error messages #6816

Closed
Aaronontheweb opened this issue Jun 26, 2023 · 0 comments
Labels
akka-ddata-durable LMDB implementation for persisting durable data good for first-time contributors up for grabs
Milestone

Comments

@Aaronontheweb
Copy link
Member

Affected libraries: Akka.DistributedData.LightningDb
Affected Versions: all

if (!Directory.Exists(_dir))
{
Directory.CreateDirectory(_dir);
}

In the event that this directory isn't writable by the process, the Akka.DistributedData.LightningDB.LmdbDurableStore will crash inside its own constructor and the real reason for the crash will be obscured by the error message:

Akka.Actor.OneForOneStrategy,Error while creating actor instance of type Akka.DistributedData.LightningDB.LmdbDurableStore with 1 args: (  keys : [shard-*]
  pruning-marker-time-to-live : "10 d"
  store-actor-class : "Akka.DistributedData.LightningDB.LmdbDurableStore, Akka.DistributedData.LightningDB"
  use-dispatcher : akka.cluster.distributed-data.durable.pinned-store
  pinned-store : {
    executor : thread-pool-executor
    type : PinnedDispatcher
  }
  lmdb : {
    dir : ddata
    map-size : "100 MiB"
    write-behind-interval : off
  }
)

We should really move this initialization to a messaging handler so we can clearly log a file permissions issue and make this easier for end-users to troubleshoot.

YariSPB added a commit to YariSPB/akka.net that referenced this issue Nov 5, 2023
Arkatufus added a commit that referenced this issue Nov 7, 2023
…outside of actor constructor (#6983)

* * moved folder construction in message handler
* created unit tests to support new changes

* *styling

* Roll back changes to original spec

* Move directory creation to PreStart instead

* Add spec that works on both windows and linux

* Cleanup rollback

* Clean copyright header

---------

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>
@Aaronontheweb Aaronontheweb added this to the 1.5.15 milestone Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
akka-ddata-durable LMDB implementation for persisting durable data good for first-time contributors up for grabs
Projects
None yet
Development

No branches or pull requests

1 participant