apache / apache/fluss

[server] Fix NPE in releaseBucket when table lease is not found

Open
#2,771 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.1k
Forks
625
Avg merge
3d 14h
Merged PRs (30d)
97

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/fluss/issues) and found nothing similar.

### Fluss version

main (development)

### Please describe the bug 🐞

In extreme scenarios of Flink Delta Join jobs, after checkpoint completes, `notifyCheckpointComplete` is triggered. Despite successful request delivery and `releaseBucket` execution in Fluss, response failure may occur for certain reasons. This causes Flink to repeatedly resend the request (and fail consistently), leading to state inconsistency between Flink and Fluss.

```
java.util.concurrent.ExecutionException: org.apache.fluss.exception.UnknownServerException: org.apache.fluss.exception.UnknownServerException: Failed to release kv snapshot lease for8af2a797-779d-4690-8e2b-14f889791412
Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.fluss.server.zk.data.lease.KvSnapshotTableLease.getBucketSnapshots()" because "tableLease" is null
at org.apache.fluss.server.coordinator.lease.KvSnapshotLeaseHandler.releaseBucket(KvSnapshotLeaseHandler.java:141)
at org.apache.fluss.server.coordinator.lease.KvSnapshotLeaseManager.lambda$release$3(KvSnapshotLeaseManager.java:267)
at org.apache.fluss.utils.concurrent.LockUtils.inLock(LockUtils.java:32)
```

### Solution

_No response_

### Are you willing to submit a PR?

- [x] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in KvSnapshotLeaseHandler.java at releaseBucket, using the stack trace's line 141, then trace the call from KvSnapshotLeaseManager.java's release method. Check how a missing table lease is handled after a successful request, and verify that releaseBucket no longer raises a NullPointerException or causes repeated request failures when the lease is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.