Repository navigation
AVRO-3803: [python] Fix remaining ipc and schema bugs - #4079
Open
kojiromike wants to merge 1 commit into
Open
kojiromike wants to merge 1 commit into
kojiromike wants to merge 1 commit into
Conversation
This fixes the two avro.ipc and schema bugs from AVRO-3803 that are still on main. apache#2319 found them but has conflicts and has gone stale, and the bytes compare part already landed in apache#3710. This is based on apache#2319 by Ari Sosnovsky. In Responder.respond(), when an AvroException is raised after the handshake for an unreadable request, an unknown message, or a response that does not match its schema, the error was written to a throwaway BytesIO and the stale buffer returned, so the requestor got a decode error (InvalidAvroBinaryEncoding) instead of the server's error. Now it keeps the handshake response and replaces whatever followed it with the system error. Also, RecordSchema set the default namespace for nested types only when the type was "record", so types defined inside an "error" lost the error's namespace. The new tests are in-memory loopback requestor and responder tests for a full round trip including the first-contact handshake, for a system error reaching the requestor, and for a response that does not match its schema reaching the requestor as an error. They also include the empty-reader FramedReader test from apache#2319 and a schema test for error namespaces. The bug tests fail without the fix. Co-authored-by: Ari Sosnovsky <asosnovsky@users.noreply.github.com> Generated-by: Claude Code 2.1.314 (Claude Opus 5.5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What is the purpose of the change
This fixes the two AVRO-3803 bugs still on main. It supersedes #2319 by @asosnovsky, which found them. Its other two fixes are already on main, one of them via #3710.
Responder.respond()lost errors raised after the handshake, including responses that don't match their schema. The requestor sawInvalidAvroBinaryEncodinginstead of the server's error.Out of scope: if the handshake itself fails (for example, the client's protocol does not parse), the reply still has no handshake, so the client cannot read it. Java behaves the same way, and the spec has no way to report a handshake error, so fixing that needs a spec decision first.
Verifying this change
Added tests cover the following scenarios:
FramedReaderempty reader from AVRO-3803: Python patched up ipc issues #2319.The bug tests fail on main without the fix. The full lang/py suite, ruff, and mypy pass locally.
Documentation
This introduces no new feature.