Skip to content
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

A column to display the port a process is listening on #244

Open
shivaraj-bh opened this issue Sep 9, 2024 · 15 comments
Open

A column to display the port a process is listening on #244

shivaraj-bh opened this issue Sep 9, 2024 · 15 comments
Labels
bug Something isn't working need more info

Comments

@shivaraj-bh
Copy link
Contributor

Feature Request

Use Case:

It will be inconvenient to scroll up the logs of the process to usually find the port it is listening on, a port column will be nice to have.

Proposed Change:

Who Benefits From The Change(s)?

Alternative Approaches

@F1bonacc1
Copy link
Owner

Hi @shivaraj-bh,

Just to make sure, are you aware that this information already exists in the general process info F3?
Do you think it deserves a dedicated column?

@shivaraj-bh
Copy link
Contributor Author

I can’t see that in F3, is there any configuration that needs to be set? in this case, the port used by postgres.
image

@shivaraj-bh
Copy link
Contributor Author

Do you think it deserves a dedicated column?

I don’t mind if its available in F3 for now, regarding whether this deserves a column, you can take call once there are enough thumbs ups on this issue.

@F1bonacc1
Copy link
Owner

Are you running postgres in a script?
The port should be visible like in the screenshot below:
image

@shivaraj-bh
Copy link
Contributor Author

Ah yes, it is in a script. Is there any workaround for such a case, i.e can we set this TCP port manually?

@thenonameguy
Copy link
Sponsor Contributor

thenonameguy commented Sep 11, 2024

Ah yes, it is in a script. Is there any workaround for such a case, i.e can we set this TCP port manually?

Use exec postgres instead of just postgres at the end of the script so the postgres process replaces the bash script.

@shivaraj-bh
Copy link
Contributor Author

Ah yes, it is in a script. Is there any workaround for such a case, i.e can we set this TCP port manually?

Use exec postgres instead of just postgres at the end of the script so the postgres process replaces the bash script.

Thanks for the suggestion. This didn’t work though. Here’s my script:

set -o errexit
set -o nounset
set -o pipefail

export PATH="/nix/store/w11g7nvm4h1ph7kjq6c4cxna3yppsn2v-postgresql-16.4/bin:/nix/store/vb8mdklw65p9wikp97ybmnyay0xzipx3-coreutils-9.5/bin:$PATH"

PGDATA=$(readlink -f "./data/pg1")
export PGDATA
exec postgres

And the corresponding screenshot with F3 on the process:
image

@thenonameguy
Copy link
Sponsor Contributor

thenonameguy commented Sep 11, 2024

Ah yes, it is in a script. Is there any workaround for such a case, i.e can we set this TCP port manually?

Use exec postgres instead of just postgres at the end of the script so the postgres process replaces the bash script.

Thanks for the suggestion. This didn’t work though. Here’s my script:

set -o errexit
set -o nounset
set -o pipefail

export PATH="/nix/store/w11g7nvm4h1ph7kjq6c4cxna3yppsn2v-postgresql-16.4/bin:/nix/store/vb8mdklw65p9wikp97ybmnyay0xzipx3-coreutils-9.5/bin:$PATH"

PGDATA=$(readlink -f "./data/pg1")
export PGDATA
exec postgres

And the corresponding screenshot with F3 on the process: image

Thanks for trying it, sorry it didn't work. Can you please post a screenshot of process-compose htop screenshot with tree mode enabled (F5)? The immediate child process should be postgresql, nothing in between.

@shivaraj-bh
Copy link
Contributor Author

image

There is a top-level script that starts process-compose and directly under it is the postgres process. This is the top-level script:

#!/nix/store/vpvy79k1qq02p1vyqjk6nb89gwhxqvyb-bash-5.2p32/bin/bash
set -o errexit
set -o nounset
set -o pipefail

export PATH="/nix/store/4sxr0bayv0rv5xpmm7ma8p8ks3ls0lml-process-compose-1.24.2/bin:$PATH"

export PC_CONFIG_FILES=/nix/store/l7dkx7fk9i6i94m32bi800wlakika46z-process-compose-postgres.json



set -x; process-compose --no-server \
 "$@"; set +x

@F1bonacc1
Copy link
Owner

Hey @shivaraj-bh,

Will you be able to provide an output of:

ss -tulpn | grep postgres

@F1bonacc1 F1bonacc1 added the bug Something isn't working label Oct 2, 2024
@shivaraj-bh
Copy link
Contributor Author

❯ ss -tulpn | grep postgres
tcp   LISTEN 0      200                                    127.0.0.1:5433       0.0.0.0:*    users:(("postgres",pid=2807031,fd=8))
tcp   LISTEN 0      200                                    127.0.0.1:5432       0.0.0.0:*    users:(("postgres",pid=2806984,fd=8))

@F1bonacc1
Copy link
Owner

tcp   LISTEN 0      200                                    127.0.0.1:5433       0.0.0.0:*    users:(("postgres",pid=2807031,fd=8))
tcp   LISTEN 0      200                                    127.0.0.1:5432       0.0.0.0:*    users:(("postgres",pid=2806984,fd=8))
                                                                                                                    ^^^^^^^

Is this PID 2806984 equal to the one shown by PC?

@shivaraj-bh
Copy link
Contributor Author

image

Yes, see pg1 and pg2. Also included pg1’s process info

@F1bonacc1
Copy link
Owner

F1bonacc1 commented Oct 2, 2024

Last question.
Can you please:

> cd /proc/net
> grep 1538 *

and share the output (including the file name).

1538 = HEX(5432)

@shivaraj-bh
Copy link
Contributor Author

tcp:   4: 0100007F:1538 00000000:0000 0A 00000000:00000000 00:00000000 00000000  1000        0 14071023 1 ffff88830e853600 100 0 0 10 0     
tcp:   5: 0100007F:DA7A 0100007F:1538 06 00000000:00000000 03:00000032 00000000     0        0 0 3 ffff888128775ed0                         
tcp:   7: 0100007F:AADC 0100007F:1538 06 00000000:00000000 03:0000041A 00000000     0        0 0 3 ffff8882a8bac660                         
tcp:  10: 0100007F:D18A 0100007F:1538 06 00000000:00000000 03:000013BA 00000000     0        0 0 3 ffff888b28b5eee0                         
tcp:  16: 0100007F:CC56 0100007F:1538 06 00000000:00000000 03:00000802 00000000     0        0 0 3 ffff8881acd96660                         
tcp:  17: 0100007F:87C0 0100007F:1538 06 00000000:00000000 03:00000BEA 00000000     0        0 0 3 ffff88835e03eaa0                         
tcp:  19: 0100007F:ED3A 0100007F:1538 06 00000000:00000000 03:00000FD2 00000000     0        0 0 3 ffff88812108ccc0 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need more info
Projects
None yet
Development

No branches or pull requests

3 participants