Skip to content

Conversation

@droberts195
Copy link

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.

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 droberts195 added review :Core/Infra/Core Core issues without another label v7.0.0 v6.2.0 labels Jan 15, 2018
@droberts195 droberts195 added v6.3.0 and removed v6.2.0 labels Jan 16, 2018
Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

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
Copy link
Member

Choose a reason for hiding this comment

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

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?

Copy link
Author

Choose a reason for hiding this comment

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

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.

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

LGTM.

@droberts195 droberts195 merged commit 5bf92ca into elastic:master Mar 14, 2018
@droberts195 droberts195 deleted the enforce_tmpdir_exists_on_startup branch March 14, 2018 15:43
droberts195 pushed 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 pushed 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 pushed 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 pushed 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 pushed 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
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 participants