-
Notifications
You must be signed in to change notification settings - Fork 3.9k
CallCredentials should respect the Deadline #4929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Even though A related issue: if |
Hmm, it doesn't seem like the behavior matches. The call seems to block until the call creds are applied. Here is a same program I used to verify: public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
Server server = NettyServerBuilder.forPort(1234)
.addService(new BigtableImplBase() {})
.build();
server.start();
ManagedChannel channel = NettyChannelBuilder.forAddress("localhost", 1234)
.usePlaintext()
.build();
BigtableBlockingStub stub = BigtableGrpc.newBlockingStub(channel)
.withCallCredentials(new HangingCallCredentials());
System.out.println("starting rpc");
try {
Iterator<ReadRowsResponse> iter = stub
.withDeadline(Deadline.after(10, TimeUnit.SECONDS))
.readRows(ReadRowsRequest.getDefaultInstance());
iter.next();
} catch (Exception e) {
System.out.println("done rpc");
e.printStackTrace();
}
Thread.sleep(60_000);
}
static class HangingCallCredentials implements CallCredentials {
@Override
public void applyRequestMetadata(MethodDescriptor<?, ?> method, Attributes attrs,
Executor appExecutor, MetadataApplier applier) {
appExecutor.execute(() -> {
try {
Thread.sleep(20_000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("done sleeping");
applier.apply(new Metadata());
});
}
@Override
public void thisUsesUnstableApi() {
}
}
} Output:
|
As @carl-mastrangelo pointed out, the effective deadline that |
Modified milestone to 'Next': Need assignment. |
Please answer these questions before submitting your issue.
What version of gRPC are you using?
1.15.1
What did you expect to see?
An RPC should never outlast a deadline set in either
CallOptions
or `grpc.What I actually saw?
CallCredentials
does not respect deadlines, so aClientCall
cannot guarantee that the RPC will finish within a set deadline (for example if an OAuth token needs to be refreshed). Furthermore, the currentCallCredential
api makes it impossible forCallCredentials
to access the deadline set inCallOptions
.The text was updated successfully, but these errors were encountered: