Skip to content

Instantly share code, notes, and snippets.

@onderkalaci
Created October 1, 2020 18:00
Show Gist options
  • Select an option

  • Save onderkalaci/65096be40bf6258c98c94c12db4481d5 to your computer and use it in GitHub Desktop.

Select an option

Save onderkalaci/65096be40bf6258c98c94c12db4481d5 to your computer and use it in GitHub Desktop.
attach process running in docker
-- find the PID of the process that is blocked, you can use pg_stat_activity or anything else
-- we'll use PID in the next steps
-- assume that we find it as 6939
-- the PID we have is running on docker
-- now, find the corresponding PID of the process on the VM
for i in $(ps -ef | grep `docker inspect --format '{​​​​{​​​​.State.Pid}​​​​}​​​​' PostgreSQLCitus` | awk '{​​​​print $2}​​​​')  ; do grep NSpid: /proc/$i/status ; done | grep 6939
NSpid: 26857 6939
-- use gdb to connect to the PID on the VM
gdb -p 26857
(gdb) bt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment