binder: rework server SecurityPolicy future handling - #12954
Open
jdcormie wants to merge 4 commits into
Open
Conversation
jdcormie
force-pushed
the
jdcormie-binder-dedup-cancellation
branch
2 times, most recently
from
July 30, 2026 00:21
c80e3d9 to
b2fbe47
Compare
jdcormie
force-pushed
the
jdcormie-binder-dedup-cancellation
branch
3 times, most recently
from
July 30, 2026 08:29
07e3a18 to
23be448
Compare
mateusazis
self-requested a review
July 30, 2026 16:31
RobolectricBinderSecurityTest has some tests already but some corners of this class are hard to reach without flakiness at the Channel/Server layer.
Include uncached methods in the deduping logic too.
jdcormie
force-pushed
the
jdcormie-binder-dedup-cancellation
branch
from
August 4, 2026 01:14
23be448 to
21328cf
Compare
mateusazis
approved these changes
Aug 4, 2026
Comment on lines
+223
to
+227
| try { | ||
| Status authResult = awaitResult(authResultFuture); | ||
| fail("Expected authResultFuture cancellation but got " + authResult); | ||
| } catch (CancellationException expected) { | ||
| } |
| fail("Expected authResultFuture cancellation but got " + authResult); | ||
| } catch (CancellationException expected) { | ||
| } | ||
| assertThat(authResultFuture.isCancelled()).isTrue(); |
Collaborator
There was a problem hiding this comment.
Isn't this redundant with expecting a CancellationException?
mateusazis
approved these changes
Aug 4, 2026
|
|
||
| fakePolicyChecker.takeNextAuthRequestOrDie().setException(new IllegalStateException("oops")); | ||
|
|
||
| ExecutionException exception = assertThrows(ExecutionException.class, () -> authResult1.get()); |
Collaborator
There was a problem hiding this comment.
Nit: use authResult1::get here as well for consistency? I think you did that in another test.
| } | ||
|
|
||
| SettableFuture<Status> takeNextAuthRequestOrDie() throws InterruptedException { | ||
| SettableFuture<Status> item = statusesToSet.poll(10, java.util.concurrent.TimeUnit.SECONDS); |
Collaborator
There was a problem hiding this comment.
Nit: import TimeUnit or static-import SECONDS.
mateusazis
approved these changes
Aug 4, 2026
| directExecutor()); | ||
| } | ||
|
|
||
| private static <T> T awaitNext(java.util.concurrent.BlockingQueue<T> queue) throws Exception { |
Collaborator
There was a problem hiding this comment.
Nit: import BlockingQueue.
| private static <T> T awaitNext(java.util.concurrent.BlockingQueue<T> queue) throws Exception { | ||
| T item = queue.poll(10, SECONDS); | ||
| if (item == null) { | ||
| throw new java.util.concurrent.TimeoutException("Queue timed out waiting for item"); |
Collaborator
There was a problem hiding this comment.
Nit: import TimeoutException.
| return item; | ||
| } | ||
|
|
||
| private static <T> T awaitResult(java.util.concurrent.Future<T> future) throws Exception { |
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.
Will not squash. Please consider each commit on its own.