Skip to content

Skip non-lease entity types in DynamoDBMultiStreamLeaseSerializer - #1792

Merged
lucienlu-aws merged 1 commit into
awslabs:masterfrom
mrhammeda:fix-multistream-serializer-null-entity-type
Jul 15, 2026
Merged

lucienlu-aws merged 1 commit into
awslabs:masterfrom
mrhammeda:fix-multistream-serializer-null-entity-type

Conversation

@mrhammeda

Copy link
Copy Markdown
Contributor

Issue #, if available: Fixes #1791

Description of changes:

DynamoDBLeaseSerializer#fromDynamoRecord(record, leaseToUpdate) returns null for records whose entityType is not LEASE (with the single table format, worker metrics and coordinator state are stored in the lease table). DynamoDBMultiStreamLeaseSerializer#fromDynamoRecord dereferenced the result unconditionally, so any MultiStreamTracker application with single table format active β€” the default for applications with a fresh lease table β€” throws NullPointerException (ERROR Failed to deserialize lease) for every non-lease item on every lease table scan, from both Scheduler.shouldInitiateLeaseSync at startup and PeriodicShardSyncManager.runShardSync thereafter.

This change returns null for non-lease records, matching the base serializer's contract (DynamoDBLeaseRefresher.list() already skips null results), and adds serializer tests mirroring DynamoDBLeaseSerializerTest: the four non-lease entity types return null instead of throwing, while LEASE and legacy no-entityType records still deserialize with the multi-stream fields intact (plus a round-trip test).

Verified with the reproducer from #1791: on a fresh application with a one-stream MultiStreamTracker against DynamoDB Local + kinesis-mock, 3.5.0 logs one NPE per non-lease item per scan (16 in a 180s run); with this change, zero errors with the same mixed lease-table contents (LEADER, CLIENT_VERSION_MIGRATION, WORKER_METRIC_STATS, LEASE). The new tests fail with the production stack trace before the fix and pass after; DynamoDBLeaseSerializerTest still passes (22 tests total).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

πŸ€– Generated with Claude Code

DynamoDBLeaseSerializer#fromDynamoRecord returns null for records whose
entityType is not LEASE (with the single table format, worker metrics
and coordinator state are stored in the lease table). The multi-stream
serializer dereferenced the result unconditionally, throwing
NullPointerException ('Failed to deserialize lease') on every lease
table scan for any MultiStreamTracker application with single table
format active - the default for applications with a fresh lease table.

Return null instead, matching the base serializer's contract, and add
serializer tests mirroring DynamoDBLeaseSerializerTest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mrhammeda
mrhammeda temporarily deployed to manual-approval July 13, 2026 22:58 — with GitHub Actions Inactive
@lucienlu-aws
lucienlu-aws merged commit abe8435 into awslabs:master Jul 15, 2026
9 of 10 checks passed
zchrss-aws added a commit to zchrss-aws/amazon-kinesis-client that referenced this pull request Jul 16, 2026
zchrss-aws added a commit that referenced this pull request Jul 21, 2026
* Prepare for KCL release v3.5.1

* Add version range for jackson-databind bump

* Add logback 1.3.16 bump to CHANGELOG

* Add #1792 to changelog

This branch was previously deployed

1 inactive deployment
manual-approval β€” 128eaba0 Deployed Jul 13, 2026 by mrhammeda via wait-for-approval #280
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.

NullPointerException in DynamoDBMultiStreamLeaseSerializer on non-lease items when single-table format is active

3 participants