Skip to content

fix: Tolerate status updates with no error in the data source outage tracker - #293

Merged
tanderson-ld merged 1 commit into
mainfrom
fix/sdk-3795-outage-tracker-null-error
Dec 1, 2026
Merged

tanderson-ld merged 1 commit into
mainfrom
fix/sdk-3795-outage-tracker-null-error

Conversation

@tanderson-ld

@tanderson-ld tanderson-ld commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #292
Tracks SDK-3795

Problem

With the FDv2 data system, FDv2DataSource reports INTERRUPTED with no error while every synchronizer is backing off. DataSourceUpdatesImpl.updateStatus hands that null error to the outage tracker, and OutageTracker.recordError dereferences it. The resulting NullPointerException reaches the catch-all in the data source loop, which logs "Unexpected error in data source" and closes the source manager. No synchronizer starts again, so the client stops making requests even after the cause (for example a 401) is resolved.

The tracker is enabled by default (logDataSourceOutageAsErrorAfter is 1 minute), so default configurations are affected. Setting it to null avoids the crash.

Affected versions: 7.18.0 through 7.19.1 and main. The null-error call was added with the RETRY orchestration change in 7.18.0 (#252). It is not present in 7.17.3 or earlier.

Change

OutageTracker.trackDataSourceState records an error only when the update carries one. The outage is still started and its timeout still scheduled, so an outage whose first report has no error is still timed.

This follows the DataSourceUpdateSink.updateStatus contract, which documents newError as "information about a new error, if any". The public status is unchanged: updateStatus already keeps the previous lastError when it is given null, and errors reported earlier are already counted.

The INTERRUPTED call with a null error in FDv2DataSource is left as is. It asserts the state while every synchronizer is parked, and the earlier errors are already in the status and the outage counts. Passing the last error again would count it once per wake-up.

Tests

Two new tests in DataSourceUpdatesImplTest, both failing with the NPE without the change:

  • A null update during an outage still reports the earlier error in the outage log.
  • A null update as the first outage report still schedules the timeout.

The full lib/sdk/server test suite passes locally. I did not run the end-to-end 401 reproduction from the issue.

Follow-ups (not in this PR)

  • FileDataSourceImpl reports INTERRUPTED with no error when its initial read fails, although it has the exception in hand.
  • An unexpected exception in the FDv2DataSource loop ends the data source permanently. Making that per-iteration would limit the impact of future bugs of this kind.

Note

Overview
Fixes a NullPointerException in the data source outage tracker when updateStatus is called with INTERRUPTED and a null error—behavior the FDv2 data source uses while synchronizers are backing off.

OutageTracker.trackDataSourceState now calls recordError only when newError != null. Outage detection, error accumulation for real errors, and the delayed outage log timeout are unchanged: an outage can still start and be timed even when the first or subsequent status update carries no error.

Two unit tests cover null-error updates during an existing outage and as the first interrupted report.

Reviewed by Cursor Bugbot for commit 6a773f5. Bugbot is set up for automated code reviews on this repo. Configure here.

…tracker

OutageTracker.recordError dereferenced the error of every INTERRUPTED update, but DataSourceUpdateSink.updateStatus allows the error to be null. FDv2DataSource reports INTERRUPTED with no error while all synchronizers are backing off, which threw a NullPointerException, ended the data source loop, and stopped all further requests. Only record an error when one is present; the outage is still started and timed.

Fixes #292
@tanderson-ld
tanderson-ld requested a review from a team as a code owner December 1, 2026 19:11
@tanderson-ld
tanderson-ld merged commit 240fd36 into main Dec 1, 2026
32 checks passed
@tanderson-ld
tanderson-ld deleted the fix/sdk-3795-outage-tracker-null-error branch December 1, 2026 20:01
tanderson-ld pushed a commit that referenced this pull request Dec 1, 2026
🤖 I have created a release *beep* *boop*
---


##
[7.19.2](launchdarkly-java-server-sdk-7.19.1...launchdarkly-java-server-sdk-7.19.2)
(2026-12-01)


### Bug Fixes

* Tolerate status updates with no error in the data source outage
tracker ([#293](#293))
([240fd36](240fd36))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> **Release 7.19.2** for `launchdarkly-java-server-sdk`: bumps the
package version from **7.19.1** to **7.19.2** in the Release Please
manifest, Gradle `version`, `Version.SDK_VERSION`, and **CHANGELOG**.
> 
> The changelog records a **bug fix**
([#293](#293)): the
**data source outage tracker** now handles status updates that carry
**no error** (e.g. interrupted/recovery transitions without an
`ErrorInfo`) instead of assuming every tracked update includes an error.
> 
> There is **no application logic** in this diff beyond version and
release metadata; the fix itself is included in the release tag this PR
prepares.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ae593ae. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

FDv2 data system: data source stops for good with a NullPointerException when all synchronizers back off (recordError(null))

3 participants