question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.NET Core 3 fails accepting Java client calls

See original GitHub issue

Issue description

We are transitioning our micro-services from .NET Core 2.1 with the old gRPC dotnet nuget, to .NET Core 3.0 with the inbuilt support for gRPC in Kestrel.

One of our clients is Android app. When tried to connect from the Android client:

Failed... : 
io.grpc.StatusRuntimeException: INTERNAL: Protocol error
Rst Stream
	at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:235)
	at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:216)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:141)
	at io.grpc.examples.helloworld.GreeterGrpc$GreeterBlockingStub.sayHello(GreeterGrpc.java:228)
	at io.grpc.helloworldexample.HelloworldActivity$GrpcTask.doInBackground(HelloworldActivity.java:90)
	at io.grpc.helloworldexample.HelloworldActivity$GrpcTask.doInBackground(HelloworldActivity.java:72)
	at android.os.AsyncTask$2.call(AsyncTask.java:333)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:764)

Set up is Development, it’s over HTTP, no TLS has been enabled.

Someone reported the same issue on stackoverflow for Kotlin

I want to point out that we tried the same Stubs with different clients like .NET Core 3.0/ Swift and even BlazorRPC and they worked without an issue.

General version information

gRPC: Java uses : 1.23.0 .NET uses: 2.23.2 Windows 10 Docker for Win 19.03.2

Images used for building the docker final image: mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build

How to reproduce:

  1. Download .NET Greeter example: https://github.com/grpc/grpc-dotnet/tree/master/examples/Greeter
  2. Download Java Greeter for Android: https://github.com/grpc/grpc-java/tree/master/examples/android/helloworld
  3. Modify proto Greeter file in .NET example by adding these extra options before the package Name:
syntax = "proto3";

option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";

package Greet;
  1. Make sure Java client Uses the modified proto to generate Stubs.
  2. Run server in Docker
  3. Get port of container and connect via Local network using IPv4 Address
  4. Call server from Client

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
ivan-penchevcommented, Sep 30, 2019

Interesting suggestion for a solution? Because I could swear I have done it. Maybe I have missed something ? How do you disable TLS on the server explicitly? Currently Java builds the channel like this:

  ManagedChannelBuilder managedChannelBuilder = ManagedChannelBuilder
                    .forAddress(mUrl, mPort)
                    .keepAliveTime(3, TimeUnit.MINUTES)
                    .keepAliveTimeout(30, TimeUnit.SECONDS).
                    .usePlaintext()
                    .build();

On the server side I use the appsettings.json

{
  "Kestrel": {
    "Endpoints": {
      "Grpc": {
        "Url": "http://*:13377",
        "Protocols": "Http2"
      }
    }
  }
}

As you can notice there is no “Certificate” path provided. @JamesNK thank you for the assistance.

1reaction
JamesNKcommented, Oct 4, 2019

I’ve managed to recreate this. I suspect the issue is in Kestrel’s implementation of HTTP/2. Something about the HTTP/2 request from the Android client is causing Kestrel to reject it.

Kestrel issue: https://github.com/aspnet/AspNetCore/issues/14745

Read more comments on GitHub >

github_iconTop Results From Across the Web

Net Core Java RMI Calls
I am looking at upgrading a Java server applications UI. The stack the team has decided is Electron with a .NET Core rest...
Read more >
Make HTTP requests using IHttpClientFactory in ASP.NET ...
A typed client accepts an HttpClient parameter in its constructor: ... Further external requests are blocked for 30 seconds if 5 failed ......
Read more >
CORS issue when angular and web API(.NET core) is used ...
In case of POST request, the browser was sending OPTIONS request first to authenticate with the server but this request will never reach...
Read more >
16 Handling Exceptions Using SOAP Faults
This chapter describes how to handle exceptions that occur when a message is being processed using Simple Object Access Protocol (SOAP) faults for...
Read more >
Introducing the .NET 6 runtime for AWS Lambda
Error.WriteLine calls are written as error level. The following example shows using info messages for logging the fetched user object.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found