Added libbacktrace support for alpine#139
Conversation
Signed-off-by: Hanxi Zhang <hanxizh@amazon.com>
rainsupreme
left a comment
There was a problem hiding this comment.
I don't know too much about docker stuff, but I left a few comments/questions 😅
| libtool \ | ||
| ; \ | ||
| # build libbacktrace from source (not available as Alpine package) | ||
| git clone --depth 1 https://github.com/ianlancetaylor/libbacktrace.git /tmp/libbacktrace; \ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Also, by any chance is this run in an isolated environment by Docker or someone else? The
git clonenetwork 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.
| automake \ | ||
| libtool \ | ||
| ; \ | ||
| # build libbacktrace from source (not available as Alpine package) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
roshkhatri
left a comment
There was a problem hiding this comment.
you will also have to run apply_templates.sh
| # 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; \ |
There was a problem hiding this comment.
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>
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 |
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
USE_LIBBACKTRACE=yesto the valkey make invocation on Alpinelibbacktrace.sointo the runtime imageRelated PR: Add libbacktrace fallback for stack traces on musl/Alpine valkey#3581