You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per documentations, we should be able to await the headers in any give ResponseFuture call.
However when the call is not implemented, the code hangs indefinitely without completing.
Sample
Using the following code I expect to always have a print at some point
Future<void> testService() async {
try {
final client =MyService.instance.client;
final request =TestRequest(name:"Test");
final responseFuture = client.sayHello(request);
var header =await responseFuture.headers; //ISSUE IN THIS LINEvar helloResponse =await responseFuture;
print(helloResponse.message);
} catch (e) {
print(e);
}
}
But in reality what is happening is that the await responseFuture.headers; never completes, hanging this future indefinitely
I created this repository to test this case, it defines a sample proto and it already include the generated pb files inside lib/services, also it includes a Simple application that shows a button to call the service and await for the result.
The text was updated successfully, but these errors were encountered:
c-lucera-pvotal
changed the title
awaiting ResponseFuture.headers hangs indefinetly for not implemented services
Awaiting ResponseFuture.headers hangs indefinetly for not implemented services
Aug 8, 2024
When terminating the call, everything is canceled/completed but _headers and _trailing
Future<void> _terminate() async {
isCancelled =true;
_timeoutTimer?.cancel();
// Don't await _responses.close() here. It'll only complete once the done// event has been delivered, and it's the caller of this function that is// reading from responses as well, so we might end up deadlocked.
_responses.close();
_stream?.terminate();
final futures =<Future>[];
if (_requestSubscription !=null) {
futures.add(_requestSubscription!.cancel());
}
if (_responseSubscription !=null) {
futures.add(_responseSubscription!.cancel());
}
awaitFuture.wait(futures);
}
Reproduced in
grpc: 4.0.0
Per documentations, we should be able to await the headers in any give ResponseFuture call.
However when the call is not implemented, the code hangs indefinitely without completing.
Sample
Using the following code I expect to always have a print at some point
But in reality what is happening is that the
await responseFuture.headers;
never completes, hanging this future indefinitelyI created this repository to test this case, it defines a sample proto and it already include the generated pb files inside
lib/services
, also it includes a Simple application that shows a button to call the service and await for the result.How to test
flutter run
on the console for your device of choiceSend request
button.Expected result
A loader is briefly shown, then a error is shown in the text over the button indicating the service is not available.
Actual result
The loader never goes away because the
var header = await responseFuture.headers;
at line 59 of main.dart never completes.Details
Running on web I get the following log, showing that something failed asyncronously but it is not rethrown/catched
The text was updated successfully, but these errors were encountered: