Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Conversation

@WeiranFang
Copy link
Contributor

To set TCP_USER_TIMEOUT socket option, we would need to use netty epoll channel, and set the keepAliveTimeout parameter:
https://github.com/grpc/grpc-java/blob/master/netty/src/main/java/io/grpc/netty/NettyClientTransport.java#L228-L234

This PR is to add the dependency of netty epoll in gax, and set the keepAliveTime and keepAliveTimeout when direct path is enabled. In this way, when the first grpc call starts, it will set the TCP_USER_TIMEOUT socket option to the value of keepAliveTimeout.

related: b/130383787

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 4, 2019
@codecov
Copy link

codecov bot commented Jun 4, 2019

Codecov Report

Merging #729 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #729      +/-   ##
============================================
+ Coverage     77.43%   77.45%   +0.01%     
  Complexity     1081     1081              
============================================
  Files           196      196              
  Lines          4707     4710       +3     
  Branches        369      369              
============================================
+ Hits           3645     3648       +3     
  Misses          895      895              
  Partials        167      167
Impacted Files Coverage Δ Complexity Δ
...api/gax/grpc/InstantiatingGrpcChannelProvider.java 78.23% <100%> (+0.39%) 36 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6aaa370...c10dfa5. Read the comment docs.

}

@Test
public void testEpollAvailable() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing that epoll is available when gax runs tests. Should this be a runtime check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's a runtime checker. So you mean this test is not helping? I just want to make sure when channel gets created, it will be using the epoll channel.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is testing that epoll channel is available when gax runs it's tests. If it's a transitive dependency of gax then this might help but it's not guaranteed. It's possible that the dependency is being pulled in by a test dependency.

What happens if epoll is not available?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I'll just remove this test. AFAICT, since gax already depends on grpc-netty-shaded, as long as the client library uses gax to create channel, they will most likely be using epoll.

If epoll is not available, say some client libraries use their own channel builder, or for a non-linux machine, then this keepAliveTimout value will not be used to set the TCP_USER_TIMEOUT socket option, because that socket option is only supported by epoll. https://github.com/grpc/grpc-java/blob/master/netty/src/main/java/io/grpc/netty/NettyClientTransport.java#L230-L233

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jun 11, 2019
@sduskis sduskis added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 12, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 12, 2019
@chingor13 chingor13 merged commit 61f236d into googleapis:master Jun 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement. 🚨 This issue needs some love.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants