Enforce that java.io.tmpdir exists on startup#28217
Merged
droberts195 merged 4 commits intoelastic:masterfrom Mar 14, 2018
Merged
Enforce that java.io.tmpdir exists on startup#28217droberts195 merged 4 commits intoelastic:masterfrom
droberts195 merged 4 commits intoelastic:masterfrom
Conversation
If the default java.io.tmpdir is used then the startup script creates it, but if a custom java.io.tmpdir is used then the user must ensure it exists before running Elasticsearch. If they forget then it can cause errors that are hard to understand, so this change adds an explicit check early in the bootstrap and reports a clear error if java.io.tmpdir is not an accessible directory.
jasontedor
reviewed
Mar 14, 2018
Member
jasontedor
left a comment
There was a problem hiding this comment.
I am so sorry for the slow review. I left a comment for consideration.
| } catch (IOException e) { | ||
| throw new BootstrapException(e); | ||
| } | ||
| // a misconfigured java.io.tmpdir can cause hard-to-diagnose problems later, so reject it immediately |
Member
There was a problem hiding this comment.
I am good with the change, but I wonder if we should validate it sooner (e.g., in Elasticsearch). There are other components of the system that might touch the java.io.tmpdir before this validation is performed?
Author
There was a problem hiding this comment.
Sure, I pushed another commit with the check moved into Elasticsearch.execute(). That method seems to be the earliest one in the Elasticsearch class that has access to an Environment object.
droberts195
added a commit
that referenced
this pull request
Mar 14, 2018
If the default java.io.tmpdir is used then the startup script creates it, but if a custom java.io.tmpdir is used then the user must ensure it exists before running Elasticsearch. If they forget then it can cause errors that are hard to understand, so this change adds an explicit check early in the bootstrap and reports a clear error if java.io.tmpdir is not an accessible directory.
droberts195
added a commit
to droberts195/elasticsearch
that referenced
this pull request
May 2, 2018
If the elasticsearch-env bash script chooses $ES_TMPDIR then it also creates the directory. This change makes elasticsearch-env.bat do the same thing: if %ES_TMPDIR% is chosen by the script then the script will ensure it exists, but if %ES_TMPDIR% is already set then the user is responsible for creating it. Relates elastic#27609 Relates elastic#28217
droberts195
added a commit
that referenced
this pull request
May 2, 2018
If the elasticsearch-env bash script chooses $ES_TMPDIR then it also creates the directory. This change makes elasticsearch-env.bat do the same thing: if %ES_TMPDIR% is chosen by the script then the script will ensure it exists, but if %ES_TMPDIR% is already set then the user is responsible for creating it. Relates #27609 Relates #28217
droberts195
added a commit
that referenced
this pull request
May 2, 2018
If the elasticsearch-env bash script chooses $ES_TMPDIR then it also creates the directory. This change makes elasticsearch-env.bat do the same thing: if %ES_TMPDIR% is chosen by the script then the script will ensure it exists, but if %ES_TMPDIR% is already set then the user is responsible for creating it. Relates #27609 Relates #28217
droberts195
added a commit
that referenced
this pull request
May 2, 2018
If the elasticsearch-env bash script chooses $ES_TMPDIR then it also creates the directory. This change makes elasticsearch-env.bat do the same thing: if %ES_TMPDIR% is chosen by the script then the script will ensure it exists, but if %ES_TMPDIR% is already set then the user is responsible for creating it. Relates #27609 Relates #28217
This file contains hidden or 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
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.
If the default java.io.tmpdir is used then the startup script creates
it, but if a custom java.io.tmpdir is used then the user must ensure it
exists before running Elasticsearch. If they forget then it can cause
errors that are hard to understand, so this change adds an explicit
check early in the bootstrap and reports a clear error if java.io.tmpdir
is not an accessible directory.