Skip to content

Conversation

@agrawaliti
Copy link
Contributor

@agrawaliti agrawaliti commented Dec 5, 2025

This pull request introduces a new mechanism to check and ensure required Linux filesystems are mounted before initializing plugins, improving error handling and preventing unexpected agent exits. The changes add a reusable function for filesystem checks and integrate it into the initialization logic of both the DNS and TCP retransmission plugins.

Filesystem check and error handling improvements:

  • Added new function CheckAndMountFilesystems in pkg/plugin/common/filesystem_linux.go to verify and log the status of required filesystems (bpf, debugfs, tracefs) before plugin initialization, returning errors if critical filesystems are missing.
  • Updated pkg/plugin/dns/dns_linux.go and pkg/plugin/tcpretrans/tcpretrans_linux.go to call CheckAndMountFilesystems in their respective Init methods, logging errors and returning them to allow the agent to decide whether to continue or fail initialization. [1] [2]

Code organization and dependencies:

  • Imported the new common package in pkg/plugin/tcpretrans/tcpretrans_linux.go to access the filesystem check functionality.
  • Added the fmt package import in pkg/plugin/dns/dns_linux.go for error wrapping and formatting.# Description

Please provide a brief description of the changes made in this pull request.

Related Issue

If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request.

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

Please add any relevant screenshots or GIFs to showcase the changes made.

Additional Notes

Add any additional notes or context about the pull request here.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.~

new error logs:
image

ticket: #1711

@agrawaliti agrawaliti requested a review from a team as a code owner December 5, 2025 17:18
@agrawaliti agrawaliti closed this Dec 5, 2025
@agrawaliti agrawaliti reopened this Dec 5, 2025
@agrawaliti agrawaliti changed the title bugfix: Filesystem check and error handling improvements fix(errorhandling): Filesystem check and error handling improvements Dec 9, 2025
…ks in DNS and TCP retrans plugins

Signed-off-by: Iti Agrawal <agrawaliti0107@gmail.com>
// CheckAndMountFilesystems checks if required filesystems are mounted.
// Returns an error if any required filesystem is not available.
// This helps prevent os.Exit() calls from dependencies that expect these filesystems.
func CheckAndMountFilesystems(l *log.ZapLogger) error {

Choose a reason for hiding this comment

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

How is this testable? Does it make sense to pass a slice of the types into this function? That way you would be able to write tests for each one of the scenarios below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed them, Kept the list of fs constant in func, as its covering all the fspath for retina.

for _, fs := range filesystems {
var statfs unix.Statfs_t
for _, path := range fs.paths {
if err := unix.Statfs(path, &statfs); err != nil {

Choose a reason for hiding this comment

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

This seems odd, if unix.Statfs returns error we continue which could be missing files, permissions correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its checking all the path and if any required fs is not mounted it returns error, made the func more verbosed

@agrawaliti agrawaliti force-pushed the debugfs-fix branch 2 times, most recently from f3a9a61 to be4acce Compare December 10, 2025 16:06
Signed-off-by: Iti Agrawal <agrawaliti0107@gmail.com>
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.

2 participants