Project

General

Profile

Actions

Feature #14750

open

pfiles on a core file could print socket information

Added by David Pacheco 19 days ago. Updated 18 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

I've got a core file from a process with a bunch of open sockets. `pfiles` on the process reports a lot more information about these sockets than `pfiles` on the core file does.

Here's pfiles on the process:

26037:  ../target/debug/deps/test_all-d586ea57740e3382 test_disk_create_disk_t
  Current rlimit: 65536 file descriptors
   0: S_IFCHR mode:0666 dev:538,0 ino:705531432 uid:0 gid:0 rdev:169,3
      O_RDWR|O_NOCTTY|O_LARGEFILE
      /dev/pts/3
      offset:1868231
   1: S_IFREG mode:0644 dev:259,65543 ino:1574780 uid:501 gid:10 size:52186
      O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE
      /home/dap/omicron/try_repro7.out
      offset:52186
   2: S_IFREG mode:0644 dev:259,65543 ino:1574780 uid:501 gid:10 size:52186
      O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE
      /home/dap/omicron/try_repro7.out
      offset:52186
   3: S_IFCHR mode:0000 dev:537,0 ino:7052 uid:0 gid:0 rdev:161,2
      O_RDWR|O_LARGEFILE FD_CLOEXEC
      /devices/pseudo/poll@0:poll
      offset:16
   4: S_IFIFO mode:0000 dev:535,0 ino:2182611 uid:501 gid:10 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
   5: S_IFIFO mode:0000 dev:535,0 ino:2182611 uid:501 gid:10 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
   6: S_IFCHR mode:0000 dev:537,0 ino:7052 uid:0 gid:0 rdev:161,2
      O_RDWR|O_LARGEFILE FD_CLOEXEC
      /devices/pseudo/poll@0:poll
      offset:16
   7: S_IFSOCK mode:0666 dev:548,0 ino:749535352 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
        SOCK_STREAM
        SO_SNDBUF(16384),SO_RCVBUF(5120)
        sockname: AF_UNIX 
        peer: test_all-d586ea[26037] zone: global[0]
   8: S_IFSOCK mode:0666 dev:548,0 ino:751287802 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
        SOCK_STREAM
        SO_SNDBUF(16384),SO_RCVBUF(5120)
        sockname: AF_UNIX 
        peer: test_all-d586ea[26037] zone: global[0]
   9: S_IFSOCK mode:0666 dev:548,0 ino:749535352 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
        SOCK_STREAM
        SO_SNDBUF(16384),SO_RCVBUF(5120)
        sockname: AF_UNIX 
        peer: test_all-d586ea[26037] zone: global[0]
  10: S_IFREG mode:0644 dev:259,65539 ino:182995 uid:501 gid:10 size:132177
      O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE FD_CLOEXEC
      /dangerzone/omicron_tmp/try_repro.21113/test_all-d586ea57740e3382-test_disk_create_disk_that_already_exists_fails.26037.0.log
      offset:132177
  11: S_IFSOCK mode:0666 dev:548,0 ino:822258188 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
        SOCK_STREAM
        SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(128000)
        sockname: AF_INET 127.0.0.1  port: 53108
  12: S_IFSOCK mode:0666 dev:548,0 ino:808845186 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
        SOCK_STREAM
        SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(128000)
        sockname: AF_INET 127.0.0.1  port: 51560
  13: S_IFDOOR mode:0444 dev:539,0 ino:52 uid:0 gid:0 rdev:541,0
      O_RDONLY|O_LARGEFILE FD_CLOEXEC  door to nscd[194]
  16: S_IFSOCK mode:0666 dev:548,0 ino:751974522 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
        SOCK_STREAM
        SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(128000)
        sockname: AF_INET6 ::1  port: 48400
  20: S_IFSOCK mode:0666 dev:548,0 ino:812075752 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
        SOCK_STREAM
        SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(128000)
        sockname: AF_INET6 ::1  port: 36799

Here's what it looks like from the core file:

core 'core.26037' of 26037:     ../target/debug/deps/test_all-d586ea57740e3382 test_disk_create_disk_t
   0: S_IFCHR mode:0666 dev:538,0 ino:705531432 uid:0 gid:0 rdev:169,3
      O_RDWR|O_NOCTTY|O_LARGEFILE
      /dev/pts/3
      offset:1868231
   1: S_IFREG mode:0644 dev:259,65543 ino:1574780 uid:501 gid:10 size:52186
      O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE
      /home/dap/omicron/try_repro7.out
      offset:52186
   2: S_IFREG mode:0644 dev:259,65543 ino:1574780 uid:501 gid:10 size:52186
      O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE
      /home/dap/omicron/try_repro7.out
      offset:52186
   3: S_IFCHR mode:0000 dev:537,0 ino:7052 uid:0 gid:0 rdev:161,2
      O_RDWR|O_LARGEFILE FD_CLOEXEC
      /devices/pseudo/poll@0:poll
      offset:16
   4: S_IFIFO mode:0000 dev:535,0 ino:2182611 uid:501 gid:10 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
   5: S_IFIFO mode:0000 dev:535,0 ino:2182611 uid:501 gid:10 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
   6: S_IFCHR mode:0000 dev:537,0 ino:7052 uid:0 gid:0 rdev:161,2
      O_RDWR|O_LARGEFILE FD_CLOEXEC
      /devices/pseudo/poll@0:poll
      offset:16
   7: S_IFSOCK mode:0666 dev:548,0 ino:749535352 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
   8: S_IFSOCK mode:0666 dev:548,0 ino:751287802 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
   9: S_IFSOCK mode:0666 dev:548,0 ino:749535352 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
  10: S_IFREG mode:0644 dev:259,65539 ino:182995 uid:501 gid:10 size:132177
      O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE FD_CLOEXEC
      /dangerzone/omicron_tmp/try_repro.21113/test_all-d586ea57740e3382-test_disk_create_disk_that_already_exists_fails.26037.0.log
      offset:132177
  11: S_IFSOCK mode:0666 dev:548,0 ino:822258188 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
  12: S_IFSOCK mode:0666 dev:548,0 ino:808845186 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
  13: S_IFDOOR mode:0444 dev:539,0 ino:52 uid:0 gid:0 rdev:541,0
      O_RDONLY|O_LARGEFILE FD_CLOEXEC
  16: S_IFSOCK mode:0666 dev:548,0 ino:751974522 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC
  20: S_IFSOCK mode:0666 dev:548,0 ino:812075752 uid:0 gid:0 rdev:0,0
      O_RDWR|O_NONBLOCK FD_CLOEXEC

The diff:

dap@ivanova issue-1224 $ diff pfiles.{core,26037}
1c1,2
< core 'core.26037' of 26037:    ../target/debug/deps/test_all-d586ea57740e3382 test_disk_create_disk_t
---
> 26037:    ../target/debug/deps/test_all-d586ea57740e3382 test_disk_create_disk_t
>   Current rlimit: 65536 file descriptors
27a29,32
>     SOCK_STREAM
>     SO_SNDBUF(16384),SO_RCVBUF(5120)
>     sockname: AF_UNIX 
>     peer: test_all-d586ea[26037] zone: global[0]
29a35,38
>     SOCK_STREAM
>     SO_SNDBUF(16384),SO_RCVBUF(5120)
>     sockname: AF_UNIX 
>     peer: test_all-d586ea[26037] zone: global[0]
31a41,44
>     SOCK_STREAM
>     SO_SNDBUF(16384),SO_RCVBUF(5120)
>     sockname: AF_UNIX 
>     peer: test_all-d586ea[26037] zone: global[0]
37a51,53
>     SOCK_STREAM
>     SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(128000)
>     sockname: AF_INET 127.0.0.1  port: 53108
39a56,58
>     SOCK_STREAM
>     SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(128000)
>     sockname: AF_INET 127.0.0.1  port: 51560
41c60
<       O_RDONLY|O_LARGEFILE FD_CLOEXEC
---
>       O_RDONLY|O_LARGEFILE FD_CLOEXEC  door to nscd[194]
43a63,65
>     SOCK_STREAM
>     SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(128000)
>     sockname: AF_INET6 ::1  port: 48400
45a68,70
>     SOCK_STREAM
>     SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(128000)
>     sockname: AF_INET6 ::1  port: 36799

This applies to UDS, INET, and INET6 sockets. All of what's in the process pfiles output is pretty useful.

I imagine this is fully reproducible. I'd attach the core file but it's much larger than the 4 MiB limit.

Actions #1

Updated by Robert Mustacchi 18 days ago

The reason for the difference in information is that the core file does not currently capture this kind of information, it basically only has information from the vnode and fd (prfdinfo_core_t). That's not to say we couldn't capture it, but that's why it is different. However, getting it there wouldn't be too bad. With the work done in 12046, we have the ability to capture a bunch of misc. data about a socket and have standard /proc information for this.

I'd suggest someone interested in this go through and we add a new note for this that covers the misc data or alternatively we define a new note that covers the current prfdinfo_t and include both in the core file. It also seems like changing pfiles to get the misc data here would also cut down on the amount of agent lwp work.

Actions

Also available in: Atom PDF