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

Initialize FD limits on MacOS and Linux platforms at startup #333

Merged
merged 8 commits into from
Nov 27, 2023

Conversation

aspect
Copy link
Collaborator

@aspect aspect commented Nov 24, 2023

MacOS allows applications to set FD limits. The same should work in Linux if you are running as a root.

This PR adds an initializer that passively attempts to configure the needed settings and warns the user if it cannot do so (the output needs to be println!() as the logging subsystem is not yet initialized.

println!("Current OS file descriptor limit (soft FD limit) is set to {limit}");
println!("The kaspad node requires a setting of at least {DESIRED_DAEMON_SOFT_FD_LIMIT} to operate properly.");
println!("Please increase the limits using the following command:");
println!("ulimit -n {DESIRED_DAEMON_SOFT_FD_LIMIT}");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it worth making a recommendation in README.md so that this can be done intentionally before the user uses kaspad?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Perhaps. I don't want to touch the readme right now because of another outstanding PR that needs a review. Now that we have discovered that this works I am much less concerned about this as it appears that rusty will now self-configure in most cases and will only fail to do this in some unusual circumstances, which I am currently not sure what they are... I think the upcoming T11 should show if there are any issues with any types of exotic hardware/setups.

kaspad/src/daemon.rs Outdated Show resolved Hide resolved
@michaelsutton michaelsutton merged commit d19e18c into kaspanet:master Nov 27, 2023
smartgoo pushed a commit to smartgoo/rusty-kaspa that referenced this pull request Jun 18, 2024
…t#333)

* Attempt to initialize OS FD limits during the kaspad startup sequence.

* cleanup

* Refactor to use setmaxstdio on windows, remove hard limit and increase DEFAULT and DESIRED limit constants.

* relocate FD limit constants to daemon so that they are available as a part of the kaspad_lib crate (this way if these values are changed, they will propagate downstream)

* rename fd_budget fn to try_set_fd_limit

* fix typo (1024->4096)

* change 4096 to 4*1024

* lints
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.

3 participants