Skip to content

fix: Stop swallowing errors in three places the Throwable audit found (JAVA-552) - #6670

Draft
runningcode wants to merge 4 commits into
9.x.xfrom
no/java-552-audit-fixes
Draft

runningcode wants to merge 4 commits into
9.x.xfrom
no/java-552-audit-fixes

Conversation

@runningcode

@runningcode runningcode commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

Fixes three bugs where a broad catch swallowed or mishandled an error:

  • QueueFile no longer deletes the offline cache when reading it runs out of memory. Only a corrupt file, which throws IndexOutOfBoundsException, resets it.
  • Installation no longer wraps an OutOfMemoryError in a RuntimeException. It reads at most 1 KB, and treats a larger or unreadable file as corrupt and writes a new id.
  • The Ktor client integration no longer swallows coroutine cancellation. It takes the failed-request body size from Content-Length instead of reading the body, so the size is missing when the response has no Content-Length.

💡 Motivation and Context

This is part of the catch (Throwable) audit. It's independent of the other JAVA-552 PRs, so it can merge in any order.

💚 How did you test it?

No new tests, only the existing ones.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

#skip-changelog

🤖 Generated with Claude Code

QueueFile deleted its file when reading it ran out of memory, as if the file were corrupt. It now resets the file only for the IndexOutOfBoundsException that a corrupt file causes.

Installation wrapped an OutOfMemoryError in a RuntimeException. It now wraps only the IOException from reading or writing the installation file.

The Ktor client integration swallowed coroutine cancellation while reading the response body for a failed-request event. It now rethrows CancellationException and fatal errors.

Refs #5513

Refs JAVA-552

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@linear-code

linear-code Bot commented Nov 18, 2026

Copy link
Copy Markdown

JAVA-552

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sentry

sentry Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.64.0 (1) release

⚙️ sentry-android Build Distribution Settings

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 18, 2026
…size

Installation read the whole installation file into memory, so an oversized file could cause an OutOfMemoryError. It now reads at most 1 KB, enough for the UUID it holds, and treats a larger or unreadable file as corrupt and writes a new id.

The Ktor client integration copied the whole response body to measure it for a failed-request event. It now takes the size from Content-Length, so it no longer reads the body at all, and can no longer swallow coroutine cancellation while doing so.

Refs #5513

Refs JAVA-552

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant