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

forbid confirmation_height_clear command when other node process is running #3855

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

JerzyStanislawski
Copy link
Contributor

Checking if other local node process is running utilizing named_mutex.
Issue: #3832

@@ -154,6 +155,8 @@ void nano_daemon::daemon::run (boost::filesystem::path const & data_path, nano::
std::cout << "Voting with more than one representative can limit performance: " << voting << " representatives are configured" << std::endl;
}
node->start ();
boost::interprocess::named_mutex process_mutex (boost::interprocess::open_or_create, "nano_node_process");
process_mutex.try_lock ();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't checking the result of try_lock.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it prevents from executing confirmation_height_clear command when other node process is running, not the other way.
Do you suggest to check the result of try_lock and exiting the node process if false?
I think it's too risky to check the mutex on node side due to possibility of mutex not being unlocked from previous run, for example when node process was killed. Then you wouldn't be able to run the node until you reboot the machine.

@dsiganos
Copy link
Contributor

dsiganos commented Jan 9, 2023

How would this work if there were more than one nano nodes running on machine?

@dsiganos dsiganos added this to the Todo milestone Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants