Repository navigation
fix/race-condition - #121
Merged
Merged
Conversation
master -> develop
Signed-off-by: Dmitry Bedrin <dmitry.bedrin@gmail.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The fixed margin can cause repeated authentication for short-lived tickets, and the concurrency behavior lacks regression tests.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Improves Kerberos TGT refresh handling to reduce expiration races.
Changes:
- Detects destroyed or missing tickets.
- Refreshes tickets within 60 seconds of expiration.
- Handles missing end times safely.
| File | Description |
|---|---|
SpnegoClient.java |
Adds defensive and early TGT expiration checks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+369
to
+370
| private boolean isExpired() { | ||
| if (tgt == null || tgt.isDestroyed()) { |
Comment on lines
+377
to
+378
| return endTime == null | ||
| || endTime.getTime() <= System.currentTimeMillis() + TGT_REFRESH_MARGIN_MILLIS; |
…egoClientBackend and KerbySpnegoClientProvider Signed-off-by: Dmitry Bedrin <dmitry.bedrin@gmail.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The fixed refresh margin can cause continuous KDC authentication for short-lived tickets.
Review effort: Balanced
Findings: 4
Open (5)
Fixed cutoff prevents caching short-lived TGTs · New Fixed cutoff invalidates short-lived tickets and causes KDC request storms · New Prevent fixed expiry margin from immediately expiring short-lived TGTs Add concurrency regression tests for ticket expiry and supplier calls Remove unrelated trailing whitespace · New
|
|
||
| private static boolean isExpired(TgtTicket tgtTicket) { | ||
| return tgtTicket.getEncKdcRepPart().getEndTime().lessThan(System.currentTimeMillis()); | ||
| private static final long TGT_REFRESH_MARGIN_MILLIS = 60_000L; |
| this.subject = subject; | ||
| } | ||
|
|
||
| private static final long TGT_REFRESH_MARGIN_MILLIS = 60_000L; |
| return new CacheKey("username-password", provider, username, password); | ||
| } | ||
|
|
||
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.


No description provided.