Skip to content

Move nio channel initialization to event loop #43780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jul 30, 2019

Conversation

Tim-Brooks
Copy link
Contributor

Currently in the transport-nio work we connect and bind channels on the
a thread before the channel is registered with a selector. Additionally,
it is at this point that we set all the socket options. This commit
moves these operations onto the event-loop after the channel has been
registered with a selector. It attempts to set the socket options for a
non-server channel at registration time. If that fails, it will attempt
to set the options after the channel is connected. This should fix
#41071.

@Tim-Brooks Tim-Brooks added >non-issue WIP :Distributed Coordination/Network Http and internode communication implementations v8.0.0 v7.3.0 labels Jun 28, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@jpountz jpountz added v7.4.0 and removed v7.3.0 labels Jul 3, 2019
@ywelsch
Copy link
Contributor

ywelsch commented Jul 17, 2019

#44355 can be reverted once this is merged

@Tim-Brooks Tim-Brooks removed the WIP label Jul 30, 2019
@Tim-Brooks Tim-Brooks requested a review from ywelsch July 30, 2019 03:03
Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

Looks good to me. Can you have a look too @original-brownbear?

socket.setReceiveBufferSize(tcpReceiveBufferSize);
}
socketOptionsSet = true;
} catch (IOException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add trace logging here so that we debug possible problems with socket options being set later?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we can do that because we have no logging infra in the nio module.

@@ -118,11 +118,11 @@ public void closeChannel() {
public NioSelector getSelector() {
throw new UnsupportedOperationException("not implemented");
}

Copy link
Contributor

Choose a reason for hiding this comment

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

undo

Copy link
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM2

@Tim-Brooks Tim-Brooks merged commit f39e8e5 into elastic:master Jul 30, 2019
jkakavas pushed a commit that referenced this pull request Jul 31, 2019
Currently in the transport-nio work we connect and bind channels on the
a thread before the channel is registered with a selector. Additionally,
it is at this point that we set all the socket options. This commit
moves these operations onto the event-loop after the channel has been
registered with a selector. It attempts to set the socket options for a
non-server channel at registration time. If that fails, it will attempt
to set the options after the channel is connected. This should fix
#41071.
Tim-Brooks added a commit to Tim-Brooks/elasticsearch that referenced this pull request Aug 2, 2019
Currently in the transport-nio work we connect and bind channels on the
a thread before the channel is registered with a selector. Additionally,
it is at this point that we set all the socket options. This commit
moves these operations onto the event-loop after the channel has been
registered with a selector. It attempts to set the socket options for a
non-server channel at registration time. If that fails, it will attempt
to set the options after the channel is connected. This should fix
elastic#41071.
@Tim-Brooks Tim-Brooks deleted the move_channel_init_to_event_loop branch April 30, 2020 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants