Skip to content

[supervisor] Show process that serves port #3374

@csweichel

Description

@csweichel
Contributor

At the moment we scan /proc/net/tcp{6} to detect which ports are being used/served in a workspace. While this works reliably, it has the major downside that we cannot tell wich process serves this port - information that would be handy to display. Also, because of the polling delay, there's a delay in port detection.

Possible solutions

seccomp-notify

User-namespaced workspaces make use of seccomp-notify. We could get notifications on accept, and use the sockfd to get more information about the socket (which port, which address). workspacekit would then provide a Unix socket on which we serve port status information (either re-using supervisor's StatusService or coming up with our own).

Alternatively, workspacekit could provide a file in a well-known location that offers port -> PID mappings, which we'd use to enhance the port information.

scanning /proc

To identify the process that's serving a port, we could also scan /proc and match the sockets inode with the process FD. With proper caching it's conceivable that this solution could come in at an acceptable CPU/performance cost.

Activity

added this to the March 2021 milestone on Mar 8, 2021
meysholdt

meysholdt commented on Mar 8, 2021

@meysholdt
Member

To create the connection -> PID mapping, maybe https://github.com/raboof/nethogs can be of inspiration. It solves the problem to show traffic per process.

modified the milestone: March 2021 on Apr 12, 2021
akosyakov

akosyakov commented on Apr 13, 2021

@akosyakov
Member

Should we close #3059 as a duplicate? Besides the process, it would be useful to see the currently running foreground command.

modified the milestone: April 2021 on Apr 13, 2021
removed this from the May 2021 (backlog) milestone on May 6, 2021
stale

stale commented on Aug 4, 2021

@stale

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

added
meta: staleThis issue/PR is stale and will be closed soon
on Aug 4, 2021
removed
meta: staleThis issue/PR is stale and will be closed soon
on May 25, 2022
removed
meta: staleThis issue/PR is stale and will be closed soon
on May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @meysholdt@svenefftinge@akosyakov@csweichel

        Issue actions

          [supervisor] Show process that serves port · Issue #3374 · gitpod-io/gitpod