Skip to content

Improve error handling in print_files #10

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

Merged
merged 1 commit into from
Jun 18, 2020

Conversation

gllghr
Copy link
Contributor

@gllghr gllghr commented Jun 17, 2020

ptools still contains some amount of hackathon-quality error handling. In particular, pfiles can panic if a file descriptor in the target process is closed while pfiles is iterating over the entries in /proc/[pid]/fd/. This modifies pfiles to instead print a message to stderr and continue iterating over the file descriptors.

delphix@jg-trunk:~/ptools$ pfiles 17902
17902:  ./test
    0: S_IFCHR mode:620 dev:0,23 ino:4 uid:65433 gid:5 rdev:136,1
       O_RDWR
       /dev/pts/1
    1: S_IFCHR mode:620 dev:0,23 ino:4 uid:65433 gid:5 rdev:136,1
       O_RDWR
       /dev/pts/1
    2: S_IFCHR mode:620 dev:0,23 ino:4 uid:65433 gid:5 rdev:136,1
       O_RDWR
       /dev/pts/1
failed to stat /proc/17902/fd/3: ENOENT: No such file or directory
    4: S_IFSOCK mode:777 dev:0,9 ino:27996 uid:0 gid:0 size:0
       O_RDWR
         SOCK_STREAM
         sockname: AF_INET 0.0.0.0  port: 5005
    ...

I'll follow up with additional PRs to clean up more of the error handling, but this should prevent the issue where pfiles occasionally creates a coredump while a support bundle is being generated.

This also modifies Cargo.toml to ensure that full debug info is generated when we do a release build, since I notice that some debug info was missing while I was investigating this issue.

Closes #9

cc @palashgandhi

@sebroy
Copy link

sebroy commented Jun 17, 2020

There's a tests directory, would running any tests in there be relevant for this PR?

Handle errors in print_files that can cause pfiles to panic if a file
descriptor is closed while it is iterating over /proc/[pid]/fd/.
@gllghr
Copy link
Contributor Author

gllghr commented Jun 18, 2020

@johngallagher-dlpx johngallagher-dlpx merged commit e777f8d into delphix:master Jun 18, 2020
@gllghr gllghr deleted the fdRace branch June 19, 2020 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

pfiles can crash when file descriptors are closed
4 participants