GeezerVison is showing github.com — [fix][schema] Fix Protobuf native descriptor deserialization by Denovo1998 · Pull Request #26725 · apache/pulsar
Conversation
Denovo1998
commented
Sep 27, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Nov 16, 2026
Reviewers
lhotari
lhotari approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
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.
|