Title: Decide session staleness on a monotonic clock in LifecycleWatcher · Issue #6663 · getsentry/sentry-java · GitHub
Open Graph Title: Decide session staleness on a monotonic clock in LifecycleWatcher · Issue #6663 · getsentry/sentry-java
X Title: Decide session staleness on a monotonic clock in LifecycleWatcher · Issue #6663 · getsentry/sentry-java
Description: When the app comes to the foreground with no background window pending, LifecycleWatcher.isSessionOnScopeStale() decides whether to start a new session. This happens when SDK init started the session, rather than the user leaving and com...
Open Graph Description: When the app comes to the foreground with no background window pending, LifecycleWatcher.isSessionOnScopeStale() decides whether to start a new session. This happens when SDK init started the sessi...
X Description: When the app comes to the foreground with no background window pending, LifecycleWatcher.isSessionOnScopeStale() decides whether to start a new session. This happens when SDK init started the sessi...
Opengraph URL: https://github.com/getsentry/sentry-java/issues/6663
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Decide session staleness on a monotonic clock in LifecycleWatcher","articleBody":"When the app comes to the foreground with no background window pending, `LifecycleWatcher.isSessionOnScopeStale()` decides whether to start a new session. This happens when SDK init started the session, rather than the user leaving and coming back. The check compares `Session.getStarted()` with the wall clock.\n\nA clock step between SDK init and the first foreground gets this wrong:\n\n* A forward step can start a second session when it shouldn't.\n* A backward step can keep a stale session.\n\nRelease health counts session starts, so either case can move session counts.\n\n## Fix\n\nLet a `Session` remember the monotonic tick it started on. Keep it in memory only and don't serialize it. Then decide staleness with a `Deadline`, as the background path already does.\n\n## Context\n\ngetsentry/sentry-java#5580 and getsentry/sentry-java#6585 were closed on 2026-11-18 because Relay ignores the session `seq` and `duration` fields. This is the one session clock issue left that affects counts.\n\n\u003cdetails>\u003csummary>Agent notes\u003c/summary>\n\n* `sentry-android-core/src/main/java/io/sentry/android/core/LifecycleWatcher.java`: see `isSessionOnScopeStale()` and its `TODO [MAJOR]` on `9.x.x` (checked 2026-11-18).\n* Relay at `f218978dbb`: `relay-server/src/metrics_extraction/sessions/mod.rs` buckets session metrics by `started` and emits only counts.\n\n\u003c/details>","author":{"url":"https://github.com/runningcode","@type":"Person","name":"runningcode"},"datePublished":"2026-11-18T15:24:17Z","url":"https://github.com/getsentry/sentry-java/issues/6663"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8ed9c0af-5ab4-fd01-eda7-97222fd9644d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D03E:613C2:13843C:1B57B7:6B046F86 |
| html-safe-nonce | d8b1af72c9e3eecae2bffed5ccfa7f9926f80055d17d103bf528ad25b2f679eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDNFOjYxM0MyOjEzODQzQzoxQjU3Qjc6NkIwNDZGODYiLCJ2aXNpdG9yX2lkIjoiMjc2OTExMjI1ODE2MzUzNTc1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 663bee00e2a441ba8c4d6c644724bde1d33bdbcc0870115a254e18e3ff682898 |
| hovercard-subject-tag | issue:6470499062 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/6663/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bebc33be0bbfefe3bd0a5ee0fd7d2c95f612a91f3d217f85d703c93ba53f5ac2/getsentry/sentry-java/issues/6663 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bebc33be0bbfefe3bd0a5ee0fd7d2c95f612a91f3d217f85d703c93ba53f5ac2/getsentry/sentry-java/issues/6663 |
| og:image:alt | When the app comes to the foreground with no background window pending, LifecycleWatcher.isSessionOnScopeStale() decides whether to start a new session. This happens when SDK init started the sessi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | runningcode |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3368190 |
| octolytics-dimension-repository_nwo | getsentry/sentry-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3368190 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfb5f24c6e01d85f70804652a5107e5cac03a161 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width