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
Make close() synchronized during node shutdown #7885
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An example scenario where this will help: When the node is shutdown via api call (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L219 ) then the call returns immediately even if the node is not actually shutdown yet (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java#L226). If at the same time the proces is killed, then the hook that would usually prevent uncontrolled shutdown (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L75) has no effect: It again calls close() which might then just return for example because one of the lifecycles was moved to closed already. The bwc test FunctionScoreBackwardCompatibilityTests.testSimpleFunctionScoreParsingWorks failed because of this. The translog was not properly written because if the shutdown was called via api, the following process.destroy() (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L225) killed the node before the translog was written to disk.
@@ -306,7 +306,7 @@ public Node stop() { | |||
return this; | |||
} | |||
|
|||
public void close() { | |||
public synchronized void close() { |
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.
I would add a comment here as to why we have the sync. Something like "during concurrent close() calls we want to make sure that all of them return after the node has completed it's shutdown cycle"
LGTM - left one minor comment |
comment added. may I push? |
brwe
added a commit
that referenced
this pull request
Sep 26, 2014
An example scenario where this will help: When the node is shutdown via api call (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L219 ) then the call returns immediately even if the node is not actually shutdown yet (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java#L226). If at the same time the proces is killed, then the hook that would usually prevent uncontrolled shutdown (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L75) has no effect: It again calls close() which might then just return for example because one of the lifecycles was moved to closed already. The bwc test FunctionScoreBackwardCompatibilityTests.testSimpleFunctionScoreParsingWorks failed because of this. The translog was not properly written because if the shutdown was called via api, the following process.destroy() (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L225) killed the node before the translog was written to disk. closes #7885
brwe
added a commit
that referenced
this pull request
Sep 26, 2014
An example scenario where this will help: When the node is shutdown via api call (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L219 ) then the call returns immediately even if the node is not actually shutdown yet (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java#L226). If at the same time the proces is killed, then the hook that would usually prevent uncontrolled shutdown (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L75) has no effect: It again calls close() which might then just return for example because one of the lifecycles was moved to closed already. The bwc test FunctionScoreBackwardCompatibilityTests.testSimpleFunctionScoreParsingWorks failed because of this. The translog was not properly written because if the shutdown was called via api, the following process.destroy() (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L225) killed the node before the translog was written to disk. closes #7885
brwe
added a commit
that referenced
this pull request
Sep 26, 2014
An example scenario where this will help: When the node is shutdown via api call (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L219 ) then the call returns immediately even if the node is not actually shutdown yet (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java#L226). If at the same time the proces is killed, then the hook that would usually prevent uncontrolled shutdown (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L75) has no effect: It again calls close() which might then just return for example because one of the lifecycles was moved to closed already. The bwc test FunctionScoreBackwardCompatibilityTests.testSimpleFunctionScoreParsingWorks failed because of this. The translog was not properly written because if the shutdown was called via api, the following process.destroy() (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L225) killed the node before the translog was written to disk. closes #7885
brwe
added a commit
that referenced
this pull request
Sep 26, 2014
An example scenario where this will help: When the node is shutdown via api call (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L219 ) then the call returns immediately even if the node is not actually shutdown yet (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java#L226). If at the same time the proces is killed, then the hook that would usually prevent uncontrolled shutdown (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L75) has no effect: It again calls close() which might then just return for example because one of the lifecycles was moved to closed already. The bwc test FunctionScoreBackwardCompatibilityTests.testSimpleFunctionScoreParsingWorks failed because of this. The translog was not properly written because if the shutdown was called via api, the following process.destroy() (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L225) killed the node before the translog was written to disk. closes #7885
clintongormley
changed the title
node shutdown: make close() syncronized
Internal: Make close() synchronized during node shutdown
Sep 26, 2014
clintongormley
changed the title
Internal: Make close() synchronized during node shutdown
Make close() synchronized during node shutdown
Jun 7, 2015
mute
pushed a commit
to mute/elasticsearch
that referenced
this pull request
Jul 29, 2015
An example scenario where this will help: When the node is shutdown via api call (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L219 ) then the call returns immediately even if the node is not actually shutdown yet (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java#L226). If at the same time the proces is killed, then the hook that would usually prevent uncontrolled shutdown (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L75) has no effect: It again calls close() which might then just return for example because one of the lifecycles was moved to closed already. The bwc test FunctionScoreBackwardCompatibilityTests.testSimpleFunctionScoreParsingWorks failed because of this. The translog was not properly written because if the shutdown was called via api, the following process.destroy() (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L225) killed the node before the translog was written to disk. closes elastic#7885
mute
pushed a commit
to mute/elasticsearch
that referenced
this pull request
Jul 29, 2015
An example scenario where this will help: When the node is shutdown via api call (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L219 ) then the call returns immediately even if the node is not actually shutdown yet (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java#L226). If at the same time the proces is killed, then the hook that would usually prevent uncontrolled shutdown (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L75) has no effect: It again calls close() which might then just return for example because one of the lifecycles was moved to closed already. The bwc test FunctionScoreBackwardCompatibilityTests.testSimpleFunctionScoreParsingWorks failed because of this. The translog was not properly written because if the shutdown was called via api, the following process.destroy() (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L225) killed the node before the translog was written to disk. closes elastic#7885
mute
pushed a commit
to mute/elasticsearch
that referenced
this pull request
Jul 29, 2015
An example scenario where this will help: When the node is shutdown via api call (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L219 ) then the call returns immediately even if the node is not actually shutdown yet (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java#L226). If at the same time the proces is killed, then the hook that would usually prevent uncontrolled shutdown (https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L75) has no effect: It again calls close() which might then just return for example because one of the lifecycles was moved to closed already. The bwc test FunctionScoreBackwardCompatibilityTests.testSimpleFunctionScoreParsingWorks failed because of this. The translog was not properly written because if the shutdown was called via api, the following process.destroy() (https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L225) killed the node before the translog was written to disk. closes elastic#7885
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An example scenario where this will help:
When the node is shutdown via api call, for example
(https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L219 )
then the call returns immediately even if the node is not actually shutdown yet
(https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java#L226).
If at the same time the proces is killed, then the hook that would usually prevent
uncontrolled shutdown
(https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java#L75)
has no effect: It again calls close() which might then just return
for example because one of the lifecycles was moved to closed already.
The bwc test FunctionScoreBackwardCompatibilityTests.testSimpleFunctionScoreParsingWorks
failed because of this. The translog was not properly
written because if the shutdown was called via api, the following process.destroy()
(https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/ExternalNode.java#L225)
killed the node before the translog was written to disk.