Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,24 @@ jobs:
docker logs smoke-aisix
test -n "$ok"

# The profiling contract from #847: the shipped binary must stay
# profileable in the field, meaning the symbol table and the DWARF
# line tables survive into the image. A future strip step,
# RUSTFLAGS change, or base-image swap would break flame graphs
# silently, so pin it here — and print the size so every PR
# records the real Linux artifact cost.
- name: Verify shipped binary keeps symbols + line tables (#847)
if: github.event_name == 'pull_request'
run: |
set -eux
IMAGE="$(printf '%s\n' "${{ steps.meta.outputs.tags }}" | head -n1)"
cid="$(docker create "$IMAGE")"
docker cp "$cid:/usr/local/bin/aisix" /tmp/aisix-shipped
docker rm "$cid"
ls -l /tmp/aisix-shipped
test "$(nm /tmp/aisix-shipped | grep -c ' [tT] ')" -gt 1000
readelf -S /tmp/aisix-shipped | grep -E '\.debug_line|\.debug_info|\.symtab'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Require both profiling sections independently.

The alternation on Line 211 passes when only one of .debug_line, .debug_info, or .symtab exists. A binary missing DWARF line tables could therefore pass the profiling guard.

Suggested fix
-          readelf -S /tmp/aisix-shipped | grep -E '\.debug_line|\.debug_info|\.symtab'
+          readelf -S /tmp/aisix-shipped | grep -q '\.symtab'
+          readelf -S /tmp/aisix-shipped | grep -q '\.debug_line'

As per coding guidelines, verification tests must define verifiable success criteria for every required artifact.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test "$(nm /tmp/aisix-shipped | grep -c ' [tT] ')" -gt 1000
readelf -S /tmp/aisix-shipped | grep -E '\.debug_line|\.debug_info|\.symtab'
test "$(nm /tmp/aisix-shipped | grep -c ' [tT] ')" -gt 1000
readelf -S /tmp/aisix-shipped | grep -q '\.symtab'
readelf -S /tmp/aisix-shipped | grep -q '\.debug_line'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/docker-image.yml around lines 210 - 211, Update the
profiling verification command near the existing nm check so `.debug_line`,
`.debug_info`, and `.symtab` are each validated independently rather than
through one alternation-based grep. Require every artifact check to succeed
while preserving the existing symbol-count validation.

Source: Coding guidelines


- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,14 @@ wiremock = "0.6"
testcontainers = "0.23"
tempfile = "3.13"

# Shipped binaries must stay profileable in the field (perf / cargo
# flamegraph against the very build a user runs), so keep the symbol
# table and DWARF line tables in release artifacts. See issue #847.
[profile.release]
lto = "thin"
codegen-units = 1
strip = "symbols"
debug = "line-tables-only"
strip = "none"

[profile.coverage]
inherits = "dev"
Expand Down
Loading