-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
What version of gRPC-Java are you using?
1.73.0
What is your environment?
Android 6.0.1 (API 23)
What did you expect to see?
I expect gRPC calls to "respawn" faster when VPN is toggled on/off
What did you see instead?
gRPC calls execution is delayed for a vast amount of time.
Steps to reproduce the bug
Execute gRPC call after VPN connection is established/teardown
I need to execute 2 "diagnostic" gRPC calls, when user establishes/destroys VPN connection.
One of my test devices (Motorola Droid Turbo, Android 6.0.1 (API 23)) executes them after a very long delay.
I believe, that this has something to do with io.grpc.android.AndroidChannelBuilder.AndroidChannel.NetworkReceiver
(or maybe with retries/backoff time), but don't understand how exactly. My other devices (Android 9, 10, 14) are doing well during this network change.
I initialize channel the following way:
return AndroidChannelBuilder.forAddress(host, BuildConfig.DEFAULT_GRPC_PORT)
.context(context)
.executor(executor)
.build()
where executor
is provided like:
val threadFactory = ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("${BuildConfig.APPLICATION_ID}-%d")
.build()
return NetworkTaggingExecutor(
trafficStatsTag = 0xFFD,
corePoolSize = 0,
maximumPoolSize = Int.MAX_VALUE,
keepAliveTime = 20L,
unit = TimeUnit.SECONDS,
workQueue = SynchronousQueue(),
threadFactory = threadFactory
)
Here some logs from custom logging ClientInterceptor
:
- VPN is established:
19:18:11.258 [GRPC] API Request GetGeoIP start
19:18:11.260 [GRPC] request 2
19:18:11.261 [GRPC] request # apps.Apps$GetGeoIPRequest@7bc6f
19:18:11.261 [GRPC] halfClose
19:18:12.702 [GRPC] API Request Ping start
19:18:12.704 [GRPC] request 2
19:18:12.705 [GRPC] request # apps.Apps$PingRequest@7bc6f
19:18:12.706 [GRPC] halfClose
>>>>>
19:21:35.789 [GRPC] API Request Ping onHeaders
19:21:35.790 [GRPC] API Request Ping message # apps.Apps$PingResponse
19:21:35.790 [GRPC] API Request Ping success
19:21:36.145 [GRPC] API Request GetGeoIP onHeaders
19:21:36.156 [GRPC] API Request GetGeoIP message # apps.Apps$GetGeoIPResponse
3 minutes 13 seconds to respawn
- VPN is teardown:
19:12:58.383 [GRPC] API Request Ping start
19:12:58.386 [GRPC] request 2
19:12:58.387 [GRPC] request # apps.Apps$PingRequest
19:12:58.387 [GRPC] halfClose
19:14:30.329 [GRPC] API Request GetGeoIP start
19:14:30.332 [GRPC] request 2
19:14:30.334 [GRPC] request # apps.Apps$GetGeoIPRequest
19:14:30.335 [GRPC] halfClose
>>>>>
19:14:55.268 [GRPC] API Request Ping onHeaders
19:14:55.270 [GRPC] API Request Ping message # apps.Apps$PingResponse
19:14:55.270 [GRPC] API Request Ping success
19:14:55.277 [GRPC] API Request GetGeoIP onHeaders
19:14:55.291 [GRPC] API Request GetGeoIP message # apps.Apps$GetGeoIPResponse
25 seconds to respawn