{"action":"closed","issue":{"url":"https://api.github.com/repos/grpc/grpc-java/issues/3056","repository_url":"https://api.github.com/repos/grpc/grpc-java","labels_url":"https://api.github.com/repos/grpc/grpc-java/issues/3056/labels{/name}","comments_url":"https://api.github.com/repos/grpc/grpc-java/issues/3056/comments","events_url":"https://api.github.com/repos/grpc/grpc-java/issues/3056/events","html_url":"https://github.com/grpc/grpc-java/issues/3056","id":233523279,"number":3056,"title":"grpc-netty:jar:1.3.0 is using a buggy netty package?","user":{"login":"alexandnpu","id":1999503,"avatar_url":"https://avatars1.githubusercontent.com/u/1999503?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandnpu","html_url":"https://github.com/alexandnpu","followers_url":"https://api.github.com/users/alexandnpu/followers","following_url":"https://api.github.com/users/alexandnpu/following{/other_user}","gists_url":"https://api.github.com/users/alexandnpu/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandnpu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandnpu/subscriptions","organizations_url":"https://api.github.com/users/alexandnpu/orgs","repos_url":"https://api.github.com/users/alexandnpu/repos","events_url":"https://api.github.com/users/alexandnpu/events{/privacy}","received_events_url":"https://api.github.com/users/alexandnpu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-06-05T08:18:29Z","updated_at":"2017-06-07T06:14:31Z","closed_at":"2017-06-07T06:14:31Z","body":"why client is using http2 when i want it to use socket to connect unix domain?\r\n`\r\n    public static void main(String[] args) throws Exception {\r\n\r\n        HelloWorldClient client = new HelloWorldClient(\r\n                NettyChannelBuilder.forAddress(new DomainSocketAddress(\"/tmp/grpc.sock\"))\r\n                .channelType(KQueueDomainSocketChannel.class)\r\n                .eventLoopGroup(new KQueueEventLoopGroup())\r\n                .usePlaintext(true)\r\n        );\r\n        try {\r\n      /* Access a service running on the local machine on port 50051 */\r\n            String user = \"world\";\r\n            if (args.length > 0) {\r\n                user = args[0]; /* Use the arg as the name to greet if provided */\r\n            }\r\n            client.greet(user);\r\n        } finally {\r\n            client.shutdown();\r\n        }\r\n    }\r\n`\r\n\r\nThe above is how I setup my client to connect to the rpc server based-on unix domain.\r\n\r\nBut I got the following exception.\r\n\r\n```\r\nJun 05, 2017 4:11:46 PM com.alex.grpctest.HelloWorldClient greet\r\nINFO: Will try to greet world ...\r\nException in thread \"main\" java.lang.RuntimeException: java.lang.InstantiationError: io.netty.util.internal.PriorityQueue\r\n\tat io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:144)\r\n\tat com.alex.grpctest.rpc.GreeterGrpc$GreeterBlockingStub.sayHello(GreeterGrpc.java:156)\r\n\tat com.alex.grpctest.HelloWorldClient.greet(HelloWorldClient.java:54)\r\n\tat com.alex.grpctest.HelloWorldClient.main(HelloWorldClient.java:80)\r\nCaused by: java.lang.InstantiationError: io.netty.util.internal.PriorityQueue\r\n\tat io.netty.handler.codec.http2.WeightedFairQueueByteDistributor$State.<init>(WeightedFairQueueByteDistributor.java:244)\r\n\tat io.netty.handler.codec.http2.WeightedFairQueueByteDistributor.<init>(WeightedFairQueueByteDistributor.java:57)\r\n\tat io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.<init>(DefaultHttp2RemoteFlowController.java:65)\r\n\tat io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.<init>(DefaultHttp2RemoteFlowController.java:56)\r\n\tat io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder.<init>(DefaultHttp2ConnectionEncoder.java:52)\r\n\tat io.grpc.netty.NettyClientHandler.newHandler(NettyClientHandler.java:145)\r\n\tat io.grpc.netty.NettyClientHandler.newHandler(NettyClientHandler.java:124)\r\n\tat io.grpc.netty.NettyClientTransport.start(NettyClientTransport.java:190)\r\n\tat io.grpc.internal.ForwardingConnectionClientTransport.start(ForwardingConnectionClientTransport.java:44)\r\n\tat io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:216)\r\n\tat io.grpc.internal.InternalSubchannel.obtainActiveTransport(InternalSubchannel.java:186)\r\n\tat io.grpc.internal.ManagedChannelImpl$SubchannelImplImpl.obtainActiveTransport(ManagedChannelImpl.java:812)\r\n\tat io.grpc.internal.GrpcUtil.getTransportFromPickResult(GrpcUtil.java:592)\r\n\tat io.grpc.internal.DelayedClientTransport.newStream(DelayedClientTransport.java:161)\r\n\tat io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:222)\r\n\tat io.grpc.stub.ClientCalls.startCall(ClientCalls.java:270)\r\n\tat io.grpc.stub.ClientCalls.asyncUnaryRequestCall(ClientCalls.java:249)\r\n\tat io.grpc.stub.ClientCalls.futureUnaryCall(ClientCalls.java:186)\r\n\tat io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:132)\r\n\t... 3 more\r\n```\r\n\r\n\r\nI can I configure my client to connect to the unix domain?\r\n\r\n\r\n## Update 1\r\n\r\nAfter some digging, I found that at this line:\r\n\r\n```\r\nio.netty.handler.codec.http2.WeightedFairQueueByteDistributor$State.<init>(WeightedFairQueueByteDistributor.java:244)\r\n```\r\nwhich is in package: netty-codec-http2-4.1.8.Final-sources.jar\r\n\r\nit is using\r\n\r\n```\r\n        State(Http2Stream stream, int initialSize) {\r\n            this.stream = stream;\r\n            queue = new PriorityQueue<State>(initialSize);\r\n        }\r\n```\r\n\r\nThere PriorityQueue is an interface which cannot be instantiated.\r\n\r\nThis might be a netty bug?\r\n\r\n\r\n## Update 2\r\n\r\nafter using `mvn dependency:tree`\r\n\r\n```\r\n➜  grpctest mvn dependency:tree\r\n[INFO] Scanning for projects...\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] Detecting the operating system and CPU architecture\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] os.detected.name: osx\r\n[INFO] os.detected.arch: x86_64\r\n[INFO] os.detected.classifier: osx-x86_64\r\n[INFO]\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] Building grpctest 1.0-SNAPSHOT\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO]\r\n[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ grpctest ---\r\n[INFO] com.alex:grpctest:jar:1.0-SNAPSHOT\r\n[INFO] +- io.grpc:grpc-netty:jar:1.3.0:compile\r\n[INFO] |  +- io.grpc:grpc-core:jar:1.3.0:compile (version selected from constraint [1.3.0,1.3.0])\r\n[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.0.19:compile\r\n[INFO] |  |  +- com.google.code.findbugs:jsr305:jar:3.0.0:compile\r\n[INFO] |  |  +- io.grpc:grpc-context:jar:1.3.0:compile\r\n[INFO] |  |  \\- com.google.instrumentation:instrumentation-api:jar:0.3.0:compile\r\n[INFO] |  +- io.netty:netty-codec-http2:jar:4.1.8.Final:compile (version selected from constraint [4.1.8.Final,4.1.8.Final])\r\n[INFO] |  |  +- io.netty:netty-codec-http:jar:4.1.8.Final:compile\r\n[INFO] |  |  |  \\- io.netty:netty-codec:jar:4.1.8.Final:compile\r\n[INFO] |  |  \\- io.netty:netty-handler:jar:4.1.8.Final:compile\r\n[INFO] |  \\- io.netty:netty-handler-proxy:jar:4.1.8.Final:compile\r\n[INFO] |     \\- io.netty:netty-codec-socks:jar:4.1.8.Final:compile\r\n[INFO] +- io.grpc:grpc-protobuf:jar:1.3.0:compile\r\n[INFO] |  +- com.google.guava:guava:jar:19.0:compile\r\n[INFO] |  +- com.google.protobuf:protobuf-java-util:jar:3.2.0:compile\r\n[INFO] |  |  \\- com.google.code.gson:gson:jar:2.7:compile\r\n[INFO] |  +- com.google.api.grpc:grpc-google-common-protos:jar:0.1.6:compile\r\n[INFO] |  \\- io.grpc:grpc-protobuf-lite:jar:1.3.0:compile\r\n[INFO] +- io.grpc:grpc-stub:jar:1.3.0:compile\r\n[INFO] +- com.google.protobuf:protobuf-java:jar:3.3.0:compile\r\n[INFO] \\- io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.11.Final:compile\r\n[INFO]    +- io.netty:netty-common:jar:4.1.11.Final:compile\r\n[INFO]    +- io.netty:netty-buffer:jar:4.1.11.Final:compile\r\n[INFO]    +- io.netty:netty-transport-native-unix-common:jar:4.1.11.Final:compile\r\n[INFO]    \\- io.netty:netty-transport:jar:4.1.11.Final:compile\r\n[INFO]       \\- io.netty:netty-resolver:jar:4.1.11.Final:compile\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] BUILD SUCCESS\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] Total time: 1.951 s\r\n[INFO] Finished at: 2017-06-05T16:53:13+08:00\r\n[INFO] Final Memory: 15M/220M\r\n[INFO] ------------------------------------------------------------------------\r\n```\r\n\r\nit is `io.grpc:grpc-netty:jar:1.3.0` that is using the buggy netty package.\r\n\r\n\r\n## Update 3\r\n\r\nThis bug is introduced in this commit:\r\n\r\nhttps://github.com/netty/netty/commit/904e70a4d4065a8e9da882e8319c7d05846c799d\r\n\r\nand it was fixed in this commit:\r\n\r\nhttps://github.com/netty/netty/commit/3482651e0c29edfa02f189751c704ebe4fe8f54c\r\n\r\nwhich is supposed to be in 4.1.11.Final.\r\n\r\nI donot know how to check whether that commit is in that release, it needs to confirm."}}
{"actor":{"display_login":"alexandnpu"}}