AppEngine executor and interceptors

82 views
Skip to first unread message

arunac...@gmail.com

unread,
Jan 24, 2019, 2:14:01 PM1/24/19
to grpc.io
I am trying to prototype a java client cache interceptor in AppEngine (java8) and gRPC(1.17.1). The cache interceptor needs to write to AppEngine memcache, so it requires thread be created via ThreadManager. When I try to supply a custom executor to gRPC via NettyChannelBuilder or withExecutor, the call is lost and future get hangs. Note that, all the grpc calls have a deadline of 10 seconds, but I don't see the timeout happening. Seems like gRPC is running into an internal error. AppEngine eventually kills the request with Deadline Exceeded error and no logs are available in the appengine console.

I went through the issue, https://github.com/grpc/grpc-java/issues/3296 and from the fix described here, https://github.com/grpc/grpc-java/pull/3382 supplying the executor should make this possible. But given the sandboxed nature of AppEngine, I don't know what is going wrong.

1.  In which thread interceptors execute ? Does it use the executor specified in the FutureStub or the event loop ?
2.  Besides the executor, what other internal threads gRPC use ? Can I control them to run on the application specified threads ?
3.  When thread issues happen, why does the gRPC call hangs, instead of timing out/failing with an error.

Thanks,
Arun.

arunac...@gmail.com

unread,
Jan 25, 2019, 3:33:57 PM1/25/19
to grpc.io
I opened this issue, https://github.com/grpc/grpc-java/issues/5286 which is the underlying problem in my opinion.

arunac...@gmail.com

unread,
Jan 25, 2019, 8:37:51 PM1/25/19
to grpc.io
Eric Andreson helped me identify the issue. AppEngine Request thread can only be started from an another request thread. Netty Pool when it tries to start, AppEngine fails the thread creation causing the request to hang. Prestarting the thread pool fixes the problem.


On Thursday, January 24, 2019 at 11:14:01 AM UTC-8, arunac...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages