Skip to content

fix(adapter): start pprof server when profiling is enabled#9008

Open
theakshaypant wants to merge 1 commit intoknative:mainfrom
theakshaypant:fix/adapter-pprof-server-not-started
Open

fix(adapter): start pprof server when profiling is enabled#9008
theakshaypant wants to merge 1 commit intoknative:mainfrom
theakshaypant:fix/adapter-pprof-server-not-started

Conversation

@theakshaypant
Copy link
Copy Markdown

Fixes #9007

Proposed Changes

The eventing adapter framework creates and configures a ProfilingServer but never calls ListenAndServe, so the profiling port is never bound even when runtime-profiling is set to enabled in the observability ConfigMap. Start the server conditionally based on the initial config, consistent with the adapter's static observability config model.

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

Profiling via the observability ConfigMap (`runtime-profiling: enabled`) now works correctly for components using the eventing adapter framework. Previously the profiling server was never started and port 8008 was never bound, making pprof endpoints unreachable.

Docs

Testing
My testing might have been limited to the use-case I was trying when I first ran into the original issue.
Covered three test scenarios:

  1. Nothing happens when config-observability has profiling disabled
  2. Enable profiling in the cm - able to access the profiling endpoints on port 8008.
  3. Enable profiling in the cm and explicitly set env on my deployment PROFILING_PORT=8090 - able to access the profiling endpoints on port 8090.

@knative-prow knative-prow bot requested review from creydr and pierDipi April 1, 2026 14:53
@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Apr 1, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: theakshaypant
Once this PR has been reviewed and has the lgtm label, please assign pierdipi for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Apr 1, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: theakshaypant / name: Akshay Pant (f81324b)

@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Apr 1, 2026

Welcome @theakshaypant! It looks like this is your first PR to knative/eventing 🎉

@knative-prow knative-prow bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 1, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Apr 1, 2026

Hi @theakshaypant. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@creydr
Copy link
Copy Markdown
Member

creydr commented Apr 1, 2026

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 1, 2026
@theakshaypant
Copy link
Copy Markdown
Author

I went through the logs from some of the failed tests and see error messages around TLS which I would guess is more of an infra issue rather than related to the PR changes. 🤔

@creydr
Copy link
Copy Markdown
Member

creydr commented Apr 2, 2026

I went through the logs from some of the failed tests and see error messages around TLS which I would guess is more of an infra issue rather than related to the PR changes. 🤔

Oh yes. Seems it needs #9009

@theakshaypant theakshaypant force-pushed the fix/adapter-pprof-server-not-started branch from cf53275 to add28c2 Compare April 6, 2026 05:23
@theakshaypant
Copy link
Copy Markdown
Author

I went through the logs from some of the failed tests and see error messages around TLS which I would guess is more of an infra issue rather than related to the PR changes. 🤔

Oh yes. Seems it needs #9009

Rebased with 9009 changes.

@creydr
Copy link
Copy Markdown
Member

creydr commented Apr 7, 2026

/test unit-tests

@theakshaypant theakshaypant force-pushed the fix/adapter-pprof-server-not-started branch from 411c3c6 to 9b7af76 Compare April 8, 2026 04:24
@knative-prow knative-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 8, 2026
The eventing adapter framework creates and configures a ProfilingServer
but never calls ListenAndServe, so the profiling port is never bound
even when runtime-profiling is set to enabled in the observability
ConfigMap. Start the server conditionally based on the initial config,
consistent with the adapter's static observability config model.

Fixes knative#9007

Signed-off-by: Akshay Pant <akpant@redhat.com>
@theakshaypant theakshaypant force-pushed the fix/adapter-pprof-server-not-started branch from 9b7af76 to f81324b Compare April 8, 2026 05:13
@theakshaypant
Copy link
Copy Markdown
Author

Apologies for the noise, added pprof server shutdown on context cancellation

$ go test -race -count=1 ./pkg/adapter/v2/ -timeout 60s
ok      knative.dev/eventing/pkg/adapter/v2     2.644s

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

Labels

ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profiling server not starting in the adapter framework

2 participants