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

Use .lock file for data directory #1989

Open
michael1011 opened this issue Nov 11, 2020 · 0 comments
Open

Use .lock file for data directory #1989

michael1011 opened this issue Nov 11, 2020 · 0 comments
Labels
database Database related issues enhancement New feature or request P3 low priority

Comments

@michael1011
Copy link
Contributor

When playing with two XUDs on a local regtest network, I noticed that they were using the same database and node public key. This is not a critical issue since I don't think that this could cause data corruption of any files, but it is an inconvenience that XUD does not prevent that from happening. There is no use case for using the same data directory for two nodes at the same time, so we should not let XUD do that since it could cause some weird behaviour.

What I propose is creating an empty .lock file for the data directory (or maybe node public key and database file) on startup and removing that file when XUD shuts down. When XUD detects that such a file exists, it should abort the startup and log that there might be an XUD running with that data directory already

@michael1011 michael1011 added enhancement New feature or request P3 low priority database Database related issues labels Nov 11, 2020
sangaman added a commit that referenced this issue Dec 2, 2020
This introduces a lock file for xud that is created in the xud data
directory any time xud starts up. Anytime a lock file already exists,
an error message is logged and xud exits. This prevents multiple
xud processes from trying to use the same node key or directory at the
same time.

The lock files are unique to each network, so running multiple processes
with different networks (e.g. simnet and mainnet) is allowed. They are
deleted when xud shuts down.

Closes #1989.
sangaman added a commit that referenced this issue Dec 2, 2020
This introduces a lock file for xud that is created in the xud data
directory any time xud starts up. Anytime a lock file already exists,
an error message is logged and xud exits. This prevents multiple
xud processes from trying to use the same node key or directory at the
same time.

The lock files are unique to each network, so running multiple processes
with different networks (e.g. simnet and mainnet) is allowed. They are
deleted when xud shuts down.

Closes #1989.
sangaman added a commit that referenced this issue Dec 2, 2020
This introduces a lock file for xud that is created in the xud data
directory any time xud starts up. Anytime a lock file already exists,
an error message is logged and xud exits. This prevents multiple
xud processes from trying to use the same node key or directory at the
same time.

The lock files are unique to each network, so running multiple processes
with different networks (e.g. simnet and mainnet) is allowed. They are
deleted when xud shuts down.

Closes #1989.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Database related issues enhancement New feature or request P3 low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant