Skip to content

Handle ApplicationExitInfo.REASON_MEMORY_LIMITER in MemoryLimiterIntegration #6134

Description

@linear-code

Summary

MemoryLimiterIntegration currently recognizes MemoryLimiter process deaths only when ApplicationExitInfo.getReason() == REASON_OTHER and the description contains the MemoryLimiter: prefix.

Android 17 / API 37.2 added ApplicationExitInfo.REASON_MEMORY_LIMITER, and our integration does not account for it yet. That means newer platform versions can report a dedicated MemoryLimiter reason that we may fail to capture.

Relevant code:

  • sentry-android-core/src/main/java/io/sentry/android/core/MemoryLimiterIntegration.java
  • sentry-android-core/src/test/java/io/sentry/android/core/MemoryLimiterIntegrationTest.kt

Android reference:

Current Behavior

MemoryLimiterPolicy.matches(...) currently returns true only when:

  • exitInfo.getReason() == ApplicationExitInfo.REASON_OTHER
  • exitInfo.getDescription() contains MemoryLimiter:

Expected Behavior

MemoryLimiterIntegration should also recognize exits reported with ApplicationExitInfo.REASON_MEMORY_LIMITER.

We should preserve current behavior for existing REASON_OTHER + MemoryLimiter: records, since older platform behavior may still surface that combination.

Acceptance Criteria

  • Update MemoryLimiterPolicy.matches(...) to handle REASON_MEMORY_LIMITER in addition to the existing legacy path.
  • Keep backward compatibility for older Android versions / SDK stubs where the new constant may not be available at compile or runtime.
  • Add regression tests covering the dedicated MemoryLimiter reason.
  • Verify existing tests around the legacy REASON_OTHER path still pass.

Notes

The implementation may need to avoid directly referencing the new constant from older compile targets if that creates compatibility issues with our current Android SDK setup.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions