GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [fix][schema] Fix Protobuf native descriptor deserialization by Denovo1998 · Pull Request #26725 · apache/pulsar

Conversation

@Denovo1998

@Denovo1998 Denovo1998 commented Sep 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Motivation

ProtobufNativeSchemaUtils.deserialize() fails to resolve nested root messages in files without a package, recurses indefinitely on cyclic imports, and leaves Java feature extensions unrecognized in the reconstructed descriptor proto. This shared utility is used by the default schema checker, broker schema validation, and generic client readers.

This is the standalone shared-deserializer prerequisite extracted from #19566. It does not add the advanced compatibility checker or change its activation policy.

Modifications

  • Resolve nested roots with or without a package, retaining legacy root-name lookup for existing stored schemas.
  • Report missing root descriptors and missing or cyclic imports as SchemaSerializationException.
  • Register Java feature extensions when running with Protobuf v4, while retaining Protobuf v3 compatibility and supporting relocated Protobuf packages.
  • Add independent descriptor and generic-reader regressions, and include the utility tests in the Protobuf v3 CI group.

Verifying this change

  • Make sure that the change passes the CI checks.

Local validation, with test retries disabled:

  • Protobuf 4.35.1: 29 focused client and broker tests passed.
  • Protobuf 3.25.5: 49 focused client and Functions tests passed.
  • ./gradlew quickCheck passed.
  • The new nested-root, malformed-import, and Java-feature regressions fail against the unpatched master implementation.

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Schema descriptor reconstruction changes for all native-schema callers. The stored schema format and message wire format are unchanged.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Denovo1998
[fix][schema] Fix Protobuf native descriptor deserialization
e3acdff
@Denovo1998
Denovo1998 marked this pull request as ready for review September 27, 2026 03:56
@Denovo1998 Denovo1998 mentioned this pull request Sep 27, 2026
[improve][broker] PIP-246: Improved PROTOBUF_NATIVE schema compatibility checks without using avro-protobuf #19566
Merged
3 of 11 tasks
lhotari
lhotari approved these changes Oct 6, 2026
View reviewed changes

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM. Thanks for tightening the native-schema deserializer and for the thorough regression tests.

I checked the change against schemas stored by older brokers and clients: the stored envelope and the file descriptor set bytes are unchanged, canonical root names (serialize() always writes getFullName()) resolve exactly as before, and malformed input now ends in SchemaSerializationException instead of an NPE or unbounded recursion. Reverting the production change makes the nested-root, missing-import, cyclic-import and missing-root tests fail, so those are pinned. The comments below are small, non-blocking points.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ProtobufNativeSchemaUtils.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ProtobufNativeSchemaUtils.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...st/java/org/apache/pulsar/broker/service/schema/ProtobufNativeSchemaDeserializationTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Denovo1998
[fix][schema] Preserve Protobuf native aliases and cache extension me…
5264bec
…tadata
@Denovo1998
Denovo1998 requested a review from lhotari October 8, 2026 12:53
lhotari
lhotari approved these changes Oct 13, 2026
View reviewed changes

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM. Thanks for the quick follow-up. All three points are handled, and I found no new problems in the new commit. The legacy-first lookup keeps previously accepted aliases resolving to the same message, the registry is now built once and published safely, and the new test assertions fail without the extension registry.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
codelipenghui
codelipenghui approved these changes Oct 13, 2026
View reviewed changes

@codelipenghui codelipenghui left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for the fix. I checked it locally:

  • The new regression tests fail against master's ProtobufNativeSchemaUtils, and pass on this head:
    • cyclic imports → StackOverflowError
    • nested root without a package → NPE
    • missing root/import → wrapped NPE
    • Java features left as unknown field 1001
  • The focused client and broker Protobuf-native tests pass with protobuf 4.35.1, with 4.36.2 (master's current version), and with 3.25.5 (client tests).
  • I compared master's root lookup with this PR on ~233k generated root names, including the regex-colliding packages (a.b/aXb, a/Cat/Ct). In files with a package, no name that resolved before now fails or resolves to a different message. The only names whose target changed are the no-package case noted inline.

LGTM. The inline comments are non-blocking nits and follow-up ideas.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ProtobufNativeSchemaUtils.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ProtobufNativeSchemaUtils.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/ProtobufNativeSchemaUtils.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...client/src/test/java/org/apache/pulsar/client/impl/schema/ProtobufNativeSchemaUtilsTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...rc/main/java/org/apache/pulsar/client/impl/ProtobufNativeSchemaDeserializationBenchmark.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@codelipenghui
codelipenghui merged commit a5e4658 into apache:master Oct 14, 2026
43 checks passed

Uh oh!

There was an error while loading. Please reload this page.

lhotari pushed a commit that referenced this pull request Oct 14, 2026
@Denovo1998 @lhotari
[fix][schema] Fix Protobuf native descriptor deserialization (#26725)
7b8d4a9
(cherry picked from commit a5e4658)
@lhotari lhotari added release/5.0.1 cherry-picked/branch-5.0 labels Oct 14, 2026
@Denovo1998
Denovo1998 deleted the fix-protobuf-native-deserialization branch October 14, 2026 12:42
@lhotari lhotari added release/4.2.6 release/4.0.15 labels Oct 16, 2026
lhotari pushed a commit that referenced this pull request Oct 16, 2026
@Denovo1998 @lhotari
[fix][schema] Fix Protobuf native descriptor deserialization (#26725)
0d06968
(cherry picked from commit a5e4658)
@lhotari lhotari added cherry-picked/branch-4.2 cherry-picked/branch-4.0 labels Oct 17, 2026
scmi-c8y pushed a commit to scmi-c8y/pulsar that referenced this pull request Oct 30, 2026
@Denovo1998 @lhotari
[fix][schema] Fix Protobuf native descriptor deserialization (apache#…
31d96c9
…26725)

(cherry picked from commit a5e4658)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Nov 16, 2026
@Denovo1998 @nodece
[fix][schema] Fix Protobuf native descriptor deserialization (apache#…
54557db
…26725)

(cherry picked from commit a5e4658)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lhotari lhotari lhotari approved these changes
@codelipenghui codelipenghui codelipenghui approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cherry-picked/branch-4.0 cherry-picked/branch-4.2 cherry-picked/branch-5.0 release/4.0.15 release/4.2.6 release/5.0.1

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Denovo1998 @lhotari @codelipenghui
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.