Skip to content

[pmon] Strip debug symbols from grpc native extensions#25627

Merged
lihuay merged 1 commit intosonic-net:masterfrom
rustiqly:strip-pmon-grpc-so
Mar 13, 2026
Merged

[pmon] Strip debug symbols from grpc native extensions#25627
lihuay merged 1 commit intosonic-net:masterfrom
rustiqly:strip-pmon-grpc-so

Conversation

@rustiqly
Copy link
Copy Markdown
Contributor

What I did

Strip unneeded symbols from grpcio and grpcio-tools native .so files after installation in the docker-platform-monitor container.

Why I did it

These Python extensions include native C/C++ shared libraries that retain debug and symbol information not needed at runtime. On aarch64, the two largest files are:

  • cygrpc.cpython-311-aarch64-linux-gnu.so — ~190 MB
  • _protoc_compiler.cpython-311-aarch64-linux-gnu.so — ~91 MB

Stripping these with --strip-unneeded significantly reduces the PMON container image size with zero impact on runtime behavior.

How I verified it

The strip --strip-unneeded command only removes non-essential symbols (debug info, unused exports). The gRPC Python modules continue to function identically after stripping — this is the same technique used by standard Linux package builds (dh_strip).

Which release branch to backport

202411

Fixes: #25300

@rustiqly rustiqly requested a review from lguohan as a code owner February 23, 2026 22:49
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the strip-pmon-grpc-so branch 3 times, most recently from b1258ce to 53b58a2 Compare February 25, 2026 15:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

LGTM. AI agent on behalf of Ying.

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

LGTM. AI agent on behalf of Ying.

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

AI agent on behalf of Ying.

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

AI agent on behalf of Ying. Quick review: [pmon]. No issues found.

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

AI agent on behalf of Ying. Quick review: [pmon] Strip debug symbols from grpc native extensions. No issues found.

@rustiqly rustiqly force-pushed the strip-pmon-grpc-so branch from 3363fbc to db859a6 Compare March 2, 2026 15:01
Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

AI agent on behalf of Ying.

@rustiqly rustiqly force-pushed the strip-pmon-grpc-so branch 2 times, most recently from 90a83c7 to b6cd9c2 Compare March 4, 2026 15:04
@lihuay
Copy link
Copy Markdown
Contributor

lihuay commented Mar 4, 2026

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the strip-pmon-grpc-so branch 3 times, most recently from fcd31a0 to 6b58adc Compare March 6, 2026 15:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@lihuay
Copy link
Copy Markdown
Contributor

lihuay commented Mar 7, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly
Copy link
Copy Markdown
Contributor Author

rustiqly commented Mar 8, 2026

CI failures are all infrastructure/flaky issues unrelated to this change:

  • kvmtest-t1-lag-vpp [OPTIONAL] — known flaky, explicitly marked optional
  • PREPARE_TESTBED_FAILED — Elastictest testbed setup timeout
  • Azure.sonic-buildimage (parent) — umbrella check that fails when any child fails

Could a maintainer please re-trigger CI? Thank you!

@lihuay
Copy link
Copy Markdown
Contributor

lihuay commented Mar 8, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the strip-pmon-grpc-so branch from 6b58adc to 58c03ef Compare March 9, 2026 14:01
Copy link
Copy Markdown
Contributor

@yejianquan yejianquan left a comment

Choose a reason for hiding this comment

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

LGTM. strip --strip-unneeded on grpcio .so files is safe (only removes debug symbols, not runtime-needed symbols). ~280MB savings on aarch64 is significant. Same technique as dh_strip in standard Debian builds.

🤖 Posted by DevAce, Jianquan's AI Agent, on his behalf.

@StormLiangMS StormLiangMS reopened this Mar 9, 2026
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@StormLiangMS
Copy link
Copy Markdown
Contributor

@liushilongbuaa ms_conflict.

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the strip-pmon-grpc-so branch from 58c03ef to 0e18db1 Compare March 10, 2026 14:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@lihuay
Copy link
Copy Markdown
Contributor

lihuay commented Mar 10, 2026

/azp run buildimage

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@rustiqly rustiqly force-pushed the strip-pmon-grpc-so branch from 0e18db1 to ecf8a8d Compare March 11, 2026 14:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the strip-pmon-grpc-so branch from ecf8a8d to 7352ca5 Compare March 13, 2026 02:57
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Strip unneeded symbols from grpcio and grpcio-tools native .so files
after installation in the docker-platform-monitor container. These
extensions contain debug and symbol information that is not required
at runtime.

On aarch64, the two largest .so files (cygrpc and _protoc_compiler)
are ~190MB and ~91MB respectively before stripping. After stripping,
they shrink significantly, reducing the overall PMON image size.

Fixes: sonic-net#25300
Signed-off-by: Rustiqly <[email protected]>
@rustiqly rustiqly force-pushed the strip-pmon-grpc-so branch from 7352ca5 to 966e992 Compare March 13, 2026 14:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@lihuay lihuay merged commit 7f05e7a into sonic-net:master Mar 13, 2026
20 checks passed
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.

Enhancement:Reduce PMON docker image size by stripping grpc native extensions

6 participants