lnd
lnd copied to clipboard
Add Critical Logging for Low Disk Space Condition
Change Description
Fixes #6693
This PR enhances disk space monitoring by introducing critical logging when free disk space drops below 5% ensuring timely alerts for potential storage issues.
Changes Introduced:
- A check was added to detect when free disk space is less than 5%.
- Logs a critical message with the exact percentage of remaining free space.
For example, if only 4% of disk space is available, the log will output:
CRITICAL: Disk space critically low: 4.0% free space remaining
Why This Change?
- Helps in proactive monitoring and prevention of storage-related failures.
- Ensures system administrators receive urgent alerts before running out of space.
Testing & Verification:
- Manually tested by simulating different free space conditions.
- Verified that logs appear correctly when threshold conditions are met.
This is my first open-source PR, and I'm excited to contribute! Feedback is welcome. 🚀
[!IMPORTANT]
Review skipped
Auto reviews are limited to specific labels.
:label: Labels to auto review (1)
- llm-review
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai planto trigger planning for file edits and PR creation.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Logging with log.Critical will cause lnd to shut down. Is that the intended behavior?
I realized I’d misunderstood the issue initially and have swapped Criticalf for Errorf, which seems better suited for managing these errors without escalating them to critical status. With this change, the node now logs a warning when available disk space drops below a threshold—say, 5%—and only shuts down if it falls below the required minimum.
On top of that, I’ve taken a stab at addressing the file descriptor concern raised in #6693. I’ve added a new file to check for available file descriptors, with the program exiting if none are free. This should help catch the problem early and keep things stable.
@guggero, whenever you’ve got a moment, I’d appreciate your take on this—especially if you think my approach misses the mark or could be improved. Let me know what you think.
Thank you
I'll take a look some time next week. In the meantime, please take a look at https://github.com/lightningnetwork/lnd/blob/master/docs/code_contribution_guidelines.md and https://github.com/lightningnetwork/lnd/blob/master/docs/code_formatting_rules.md.
@arnav-makkar, the PR should be submitted as a final version ready for review. Currently, the code isn’t compiling and needs to be fixed before it can be properly reviewed. Keep up the good work! :wink:
Hi @MPins, Thank you for your suggestions. I’ll integrate your feedback and ensure my code adheres to the contribution guidelines. I appreciate your insights and will share the final version once I’ve completed the updates and performed the necessary checks. Thanks again for your support
Hi @MPins, Thank you for your suggestions. I’ll integrate your feedback and ensure my code adheres to the contribution guidelines. I appreciate your insights and will share the final version once I’ve completed the updates and performed the necessary checks. Thanks again for your support
hey @arnav-makkar I'm currently reviewing your PR, and to get a deeper understanding of your changes, I checked out your fork and attempted to build the code locally. However, I ran into an issue where healthcheck.CheckFileDescriptors() in server.go is throwing an “undefined” error during build. I’ve verified that the function exists in healthcheck/fdcheck.go and that the package is properly imported. I'm working on WSL (Ubuntu), so I’m wondering—did you encounter this as well, or could this be environment-specific
- in the server.go file ....The warning threshold for disk space is hardcoded; consider making it configurable or documenting it.
@AbhinavAnand241201 feedback comments like this are provided inline. Please refer to other pr reviews to learn how the reviews are submitted on specific code change suggestions.
@arnav-makkar, remember to re-request review from reviewers when ready
!lightninglabs-deploy mute
Closing due to inactivity