Repository navigation
ref(core): Measure the hostname cache TTL on a monotonic ticker (JAVA-579) - #6100
Merged
Merged
Conversation
9 tasks done
📲 Install BuildsAndroid
|
runningcode
force-pushed
the
no/java-579-c6-hostname-cache-ttl
branch
from
September 15, 2026 14:10
1742189 to
378d9be
Compare
9 tasks done
runningcode
force-pushed
the
no/java-579-c6-hostname-cache-ttl
branch
2 times, most recently
from
October 14, 2026 07:43
2cd4aaf to
fbec6c7
Compare
runningcode
changed the base branch from
main
to
no/java-579-c6b-hostname-cache-on-options
October 14, 2026 07:43
Base automatically changed from
no/java-579-c6b-hostname-cache-on-options
to
main
October 14, 2026 13:32
…-579) HostnameCache stored an absolute expiry built from System.currentTimeMillis() and compared it against a fresh reading of the same clock, so a device time change resized the 5 hour TTL: a backward step extended it, a forward step expired the cache early. It is now a Deadline on a MonotonicTicker. The ticker comes from SentryOptions.getMonotonicTicker(), the same way RateLimiter takes it, so on Android the TTL also counts time spent in deep sleep. The cache names the ticker as its only collaborator rather than taking the whole options. The LazyEvaluator that holds the cache defers reading the ticker until after SentryAndroidOptions has overridden it. The expiry no longer starts at 0: on a boot-relative ticker 0 is a real and very recent instant, so it would read as freshly set rather than unset. It starts as Deadline.passed(ticker) instead. The TTL is not a serialized value, so this is not gated behind v9. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A superclass field initializer already dispatches to the subclass override of getMonotonicTicker(), and SentryAndroidOptions returns a static singleton, so building the cache eagerly would read the right ticker too. The blocking hostname lookup is the only reason it is lazy. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
runningcode
force-pushed
the
no/java-579-c6-hostname-cache-ttl
branch
from
October 14, 2026 14:15
8490310 to
9ff0dcf
Compare
…ctor Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…or testing Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
runningcode
commented
Oct 14, 2026
runningcode
marked this pull request as ready for review
October 14, 2026 14:30
runningcode
requested review from
0xadam-brown,
adinauer,
markushi and
romtsn
as code owners
October 14, 2026 14:30
romtsn
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Previously the
HostnameCachemeasured the TTL withSystem.currentTimeMillis()so when device time changes forward or backward it would extend the cache or expire the cache early.The TTL is now a
Deadlineon the ticker fromSentryOptions.getMonotonicTicker(). On Android that iselapsedRealtimeNanos(), so the TTL also counts deep sleep.The deadline starts as
Deadline.passed(ticker)rather than0: on a boot-relative ticker0is a recent instant and would read as freshly cached. (this was previously a bug)The TTL only decides when the hostname is re-resolved and is never serialized, so this is not gated on v9. (feel free to disagree)
Stacked on #6117, which moves the cache onto
SentryOptions.💡 Motivation and Context
One of the wall-clock TTL sites from audit finding:
HostnameCacheTTL only)💚 How did you test it?
Easier to test since we can advance the clock.
📝 Checklist
sendDefaultPIIis enabled.No public API change;
sentry.apiis unchanged.🔮 Next steps
🤖 Generated with Claude Code