-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix issue where pages aren't released #27459
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
Conversation
This is related to elastic#27422. Right now when we do a write in the netty transport, we attach a listener to the future. When you submit a write on the netty event loop and the event loop is shutdown, the onFailure method is called. Unfortunately, netty then tries to notify the listener which cannot be done without dispatching to the event loop. In this case, the dispatch fails and netty logs and error and does not tell us. This commit checks that netty is still running before sending a message. This will not 100% fix this issue, but it should reduce it.
|
I also opened an issue with netty for this. |
s1monw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general & good catch. I left one request
| }); | ||
| channel.writeAndFlush(Netty4Utils.toByteBuf(reference), writePromise); | ||
|
|
||
| if (channel.eventLoop().isShutdown()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we protect this from double invocation? I think we should just make sure we only invoke once. can you wrap it in here and ensure that? maybe just use NotifyOnceListener
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well - the only place we call this is from internalSendMessage.
private void internalSendMessage(TcpChannel channel, BytesReference message, SendMetricListener listener) {
try {
channel.sendMessage(message, listener);
} catch (Exception ex) {
// call listener to ensure that any resources are released
listener.onFailure(ex);
onException(channel, ex);
}
}
And SendMetricListener is a NotifyOnceListener. So incidentally - yes it is always a notify once listener. Do you want me to codify that by changing the signature of TcpChannel#sendMessage to:
/**
* Sends a tcp message to the channel. The listener will be executed once the send process has been
* completed.
*
* @param reference to send to channel
* @param listener to execute upon send completion
*/
void sendMessage(BytesReference reference, NotifyOnceListener<Void> listener);
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's find in this case! LGTM
This is related to #27422. Right now when we send a write to the netty transport, we attach a listener to the future. When you submit a write on the netty event loop and the event loop is shutdown, the onFailure method is called. Unfortunately, netty then tries to notify the listener which cannot be done without dispatching to the event loop. In this case, the dispatch fails and netty logs and error and does not tell us. This commit checks that netty is still not shutdown after sending a message. If netty is shutdown, we complete the listener.
jasontedor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for opening the issue against Netty too.
* master: (41 commits) [Test] Fix AggregationsTests#testFromXContentWithRandomFields [DOC] Fix mathematical representation on interval (range) (elastic#27450) Update version check for CCS optional remote clusters Bump BWC version to 6.1.0 for elastic#27469 Adapt rest test BWC version after backport Fix dynamic mapping update generation. (elastic#27467) Use the primary_term field to identify parent documents (elastic#27469) Move composite aggregation to core (elastic#27474) Fix test BWC version after backport Protect shard splitting from illegal target shards (elastic#27468) Cross Cluster Search: make remote clusters optional (elastic#27182) [Docs] Fix broken bulleted lists (elastic#27470) Move resync request serialization assertion Fix resync request serialization Fix issue where pages aren't released (elastic#27459) Add YAML REST tests for filters bucket agg (elastic#27128) Remove tcp profile from low level nio channel (elastic#27441) [TEST] Fix `GeoShapeQueryTests#testPointsOnly` failure Transition transport apis to use void listeners (elastic#27440) AwaitsFix GeoShapeQueryTests#testPointsOnly elastic#27454 ...
This is related to #27422. Right now when we send a write to the netty
transport, we attach a listener to the future. When you submit a write
on the netty event loop and the event loop is shutdown, the onFailure
method is called. Unfortunately, netty then tries to notify the listener
which cannot be done without dispatching to the event loop. In this
case, the dispatch fails and netty logs and error and does not tell us.
This commit checks that netty is still not shutdown after sending a
message. If netty is shutdown, we complete the listener.