Skip to content

Added libbacktrace support for alpine#139

Open
hanxizh9910 wants to merge 3 commits into
valkey-io:mainlinefrom
hanxizh9910:fix/alpine-backtrace-support
Open

Added libbacktrace support for alpine#139
hanxizh9910 wants to merge 3 commits into
valkey-io:mainlinefrom
hanxizh9910:fix/alpine-backtrace-support

Conversation

@hanxizh9910
Copy link
Copy Markdown
Contributor

@hanxizh9910 hanxizh9910 commented Apr 28, 2026

libbacktrace is not available as an Alpine package, so this PR builds it from source during the Alpine Docker build and links it into the final image

Signed-off-by: Hanxi Zhang <hanxizh@amazon.com>
@hanxizh9910 hanxizh9910 marked this pull request as draft April 28, 2026 21:27
@hanxizh9910 hanxizh9910 marked this pull request as ready for review April 30, 2026 01:00
@hanxizh9910 hanxizh9910 marked this pull request as draft April 30, 2026 01:02
@hanxizh9910 hanxizh9910 marked this pull request as ready for review April 30, 2026 01:35
Copy link
Copy Markdown

@rainsupreme rainsupreme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know too much about docker stuff, but I left a few comments/questions 😅

Comment thread Dockerfile.template Outdated
libtool \
; \
# build libbacktrace from source (not available as Alpine package)
git clone --depth 1 https://github.com/ianlancetaylor/libbacktrace.git /tmp/libbacktrace; \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should pick a specific commit of libbacktrace to make this more secure against dependency injection. I think we should also add a comment with the commit date to give us an idea of whether it needs to be updated.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, by any chance is this run in an isolated environment by Docker or someone else? The git clone network access would fail in that case. I don't know if this is actually an issue though

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, by any chance is this run in an isolated environment by Docker or someone else? The git clone network access would fail in that case. I don't know if this is actually an issue though

Hi, thank you for your question! Docker builds have network access during build time. The existing Dockerfile already uses ADD to download the valkey tarball from GitHub, so git clone works the same way.

Comment thread Dockerfile.template
automake \
libtool \
; \
# build libbacktrace from source (not available as Alpine package)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unfamiliar with our docker releases so please excuse my ignorance, but does this mean libbacktrace gets built on other platforms even when it is not used? (Alternatively, would we like to add libbacktrace to all our docker releases? I think that would be valuable.)

The {{ if env.variant == "alpine" then ( -}} check below suggests that this is run on alpine and other platforms, but I'm not sure which those are.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, the libbacktrace build is inside the Alpine-only block, so it doesn't run on Debian.
Enabling libbacktrace on Debian is a good idea, it would give us more information. If the team thinks this is great, I can definitely do it in a follow-up PR.

Signed-off-by: Hanxi Zhang <hanxizh@amazon.com>
Copy link
Copy Markdown
Member

@roshkhatri roshkhatri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will also have to run apply_templates.sh

Comment thread Dockerfile.template Outdated
# pinned to commit 96664e69b1ecdb76e824be1d9e8f475b76dd08cf (2026-05-03)
git clone --depth 1 https://github.com/ianlancetaylor/libbacktrace.git /tmp/libbacktrace; \
cd /tmp/libbacktrace; \
git checkout 96664e69b1ecdb76e824be1d9e8f475b76dd08cf; \
Copy link
Copy Markdown
Member

@roshkhatri roshkhatri May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can directly clone at that commit hash above - Sorry I am wrong inthis
We should hard reset to the commit, libbacktrace does not have a release or a branch or a tag

…it checkout

Signed-off-by: Hanxi Zhang <hanxizh@amazon.com>
Copy link
Copy Markdown

@rainsupreme rainsupreme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking improved 🙂 Seems like there are failing workflows though? Did you test this after your recent update? (if so I didn't catch it)

@hanxizh9910 hanxizh9910 self-assigned this May 7, 2026
@hanxizh9910
Copy link
Copy Markdown
Contributor Author

It's looking improved 🙂 Seems like there are failing workflows though? Did you test this after your recent update? (if so I didn't catch it)

Hi, the CI failure is expected, the container PR depends on valkey#3581 (valkey-io/valkey#3581) being merged first: the unstable Alpine build fails because it downloads from valkey-io/valkey:unstable, which doesn't have the musl/Alpine backtrace support yet. Once #3581 merges, this will pass on the next CI run. The stable version builds (7.2, 8.0, 8.1, 9.0) fail because those are fixed release tarballs that were cut before the fix existed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants