docker-library / docker-library/postgres
Debug Symbols
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 2.5k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Problem
The postgres binaries shipped with the docker images in this repo seem to be stripped:
root@0d42c3d8cd06:/# postgres --version
postgres (PostgreSQL) 12.1 (Debian 12.1-1.pgdg100+1)
root@0d42c3d8cd06:/# file $(which postgres)
/usr/lib/postgresql/12/bin/postgres: ELF 64-bit LSB shared object, x86-64, version 1
(SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux
3.2.0, BuildID[sha1]=e775eb7dcaa0306329f0624056df0fa892d48f03, stripped
-----------------------------------------------------------------^
This makes it difficult to use tools such as gdb or perf to debug problems as the resulting stack traces will often be useless.
See my tweet here for a practical example of what can be done when symbols are present.
Proposal
It'd be great if this image would start to ship with debug symbols by default, e.g. by compiling with ./configure CFLAGS="-fno-omit-frame-pointer -ggdb".
If not, it'd be great to document how to derive an image that includes symbols. My first attempts at doing so below have failed. I still get the same output for file $(which postgres) as above, and readelf -s $(which postgres) | wc -l gives me the same ~9k symbols contained in this image, rather than the ~30k symbols usually available for a non-stripped postgres binary.
FROM postgres
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
debian-goodies \
binutils
RUN apt-get install -y $(find-dbgsym-packages $(which postgres))
I suspect the image above doesn't work because postgres is pulled from apt.postgresql.org, but find-dbgsym-packages is not smart enough to search that repo for debug package, if those even exist.
I'd be happy to try to help with creating a PR to improve the debugging/symbol situation once the direction is clear.
From my PoV the only downside to including symbols is image size, so maybe they shouldn't go into the alpine flavor of this image.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the image build configuration and inspect the postgres entry point using file and readelf; review the proposed configure CFLAGS and find-dbgsym-packages approach. Done means establishing a supported way for the images to provide usable debug symbols, or documenting a reproducible derived-image workflow and its image-size and flavor trade-offs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, postgres
- Domain
- database, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100