What version of gRPC are you using?
1.4.0
What JVM are you using (java -version)?
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Google-cloud-java has received issues (googleapis/google-cloud-java#2150, googleapis/google-cloud-java#2275) regarding sending grpc reqeust in appengine (specifically, using google-cloud-java Pub/Sub client library). When initiating grpc connection in appengine, grpc picks up currentRequestThreadFactory for its thread factory (https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/GrpcUtil.java#L482). This could cause appengine runtime to throw NPE (see below for a typical stack trace). A hack to force defaultThreadFactory to be used by Grpc seems to resolve this issue.
Sending Grpc request within Appengine request thread seems to be a valid scenario. Grpc should support it.
java.lang.NullPointerException
at com.google.apphosting.runtime.ApiProxyImpl$CurrentRequestThreadFactory.newThread(ApiProxyImpl.java:1267)
at com.google.common.util.concurrent.ThreadFactoryBuilder$1.newThread(ThreadFactoryBuilder.java:162)
at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:612)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:925)
at java.util.concurrent.ThreadPoolExecutor.ensurePrestart(ThreadPoolExecutor.java:1587)
at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:336)
at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:555)
at io.grpc.internal.ManagedChannelImpl.rescheduleIdleTimer(ManagedChannelImpl.java:334)
at io.grpc.internal.ManagedChannelImpl.exitIdleMode(ManagedChannelImpl.java:299)
at io.grpc.internal.ManagedChannelImpl$4$1.run(ManagedChannelImpl.java:357)
at io.grpc.internal.ChannelExecutor.drain(ChannelExecutor.java:87)
at io.grpc.internal.ManagedChannelImpl$4.get(ManagedChannelImpl.java:359)
at io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:218)
at io.grpc.ForwardingClientCall.start(ForwardingClientCall.java:47)
at com.google.api.gax.grpc.GrpcHeaderInterceptor$1.start(GrpcHeaderInterceptor.java:62)
at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:276)
at io.grpc.stub.ClientCalls.asyncUnaryRequestCall(ClientCalls.java:252)
at io.grpc.stub.ClientCalls.futureUnaryCall(ClientCalls.java:186)
at com.google.pubsub.v1.PublisherGrpc$PublisherFutureStub.publish(PublisherGrpc.java:538)
at com.google.cloud.pubsub.v1.Publisher.publishOutstandingBatch(Publisher.java:330)
at com.google.cloud.pubsub.v1.Publisher.publishAllOutstanding(Publisher.java:304)
at com.google.cloud.pubsub.v1.Publisher.access$500(Publisher.java:79)
at com.google.cloud.pubsub.v1.Publisher$5.run(Publisher.java:283)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:295)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
/cc @jbaldassari @cmaan @jabubake @tcoffee-google @garrettjonesgoogle
What version of gRPC are you using?
1.4.0
What JVM are you using (
java -version)?Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Google-cloud-java has received issues (googleapis/google-cloud-java#2150, googleapis/google-cloud-java#2275) regarding sending grpc reqeust in appengine (specifically, using google-cloud-java Pub/Sub client library). When initiating grpc connection in appengine, grpc picks up
currentRequestThreadFactoryfor its thread factory (https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/GrpcUtil.java#L482). This could cause appengine runtime to throw NPE (see below for a typical stack trace). A hack to forcedefaultThreadFactoryto be used by Grpc seems to resolve this issue.Sending Grpc request within Appengine request thread seems to be a valid scenario. Grpc should support it.
/cc @jbaldassari @cmaan @jabubake @tcoffee-google @garrettjonesgoogle