Skip to content
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

Elasticsearch-plugin fills tmp with empty dirs #34445

Closed
PereBal opened this issue Oct 15, 2018 · 6 comments · Fixed by #41913
Closed

Elasticsearch-plugin fills tmp with empty dirs #34445

PereBal opened this issue Oct 15, 2018 · 6 comments · Fixed by #41913
Labels
>bug :Core/Infra/Plugins Plugin API and infrastructure help wanted adoptme

Comments

@PereBal
Copy link

PereBal commented Oct 15, 2018

Elasticsearch version (bin/elasticsearch --version): 5.6.2 to 6.4.1 (at least)

Plugins installed: []

JVM version (java -version): 1.8

OS version (uname -a if on a Unix-like system): CentOs7

Description of the problem including expected versus actual behavior: Running elasticsearch-plugin list creates a directory under /tmp every run. If the directory is necessary for the run I expect the tool to either reuse it or clean it up after usage.

Steps to reproduce:

Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.

  1. List dirs under /tmp matching elasticsearch.: ls /tmp | grep 'elasticsearch\.'
  2. Run plugin list: bin/elasticsearch-plugin list
  3. List dirs under /tmp matching elasticsearch. again, a new dir should be there every execution

Provide logs (if relevant):

[.@host /tmp]$ ls -l | grep 'elasticsearch\.'
[.@host /tmp]$ sudo ES_PATH_CONF=/etc/elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin list --verbose
Plugins directory: /usr/share/elasticsearch/plugins
[.@host /tmp]$ ls -l | grep 'elasticsearch\.'
drwx------ 2 root          root          4096 Oct 15 11:02 elasticsearch.yurOJFCO
[.@host /tmp]$ sudo ES_PATH_CONF=/etc/elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin list
[.@host /tmp]$ ls -l | grep 'elasticsearch\.'
drwx------ 2 root          root          4096 Oct 15 11:02 elasticsearch.v9avpNCr
drwx------ 2 root          root          4096 Oct 15 11:02 elasticsearch.yurOJFCO
@spinscale spinscale added >bug :Core/Infra/Plugins Plugin API and infrastructure labels Oct 15, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@spinscale
Copy link
Contributor

I can reproduce this under Linux (not under osx though) using 6.4.2.

This should indeed be cleaned up.

@rjernst
Copy link
Member

rjernst commented Oct 15, 2018

This happens because elasticsearch-env (which is called by all of our scripts, including bin/elasticsearch) calls mktemp. We might want to only to set the temp dir like this when running elasticsearch? /cc @jasontedor

@jasontedor
Copy link
Member

We can look into improving this. However, what is the concrete user-facing problem here? Knowing this will help us prioritize the effort. Modern systemd-based systems will clean /tmp periodically, and it will clean itself on reboot.

@PereBal
Copy link
Author

PereBal commented Oct 16, 2018

@jasontedor we have a very heterogeneous cluster topology and use elasticsearch-plugin list to decide what is the connection method for our health checks (mostly if xpack is installed then https else http) .

As you can guess, even if the Os might rotate /tmp and it should be mounted as tmpfs, a new dir every execution and frequent executions have caused us inode starvation issues.

I can imagine your thoughts for not prioritizing this, but in that case, what would be a good alternative for us?

@jasontedor
Copy link
Member

@PereBal Thanks for clarifying.

As a workaround, for now you can set ES_TMPDIR explicitly to a specific temporary directory and each invocation of elasticsearch-plugin will reuse that temporary directory.

rjernst added a commit to rjernst/elasticsearch that referenced this issue May 7, 2019
The elasticsearch-cli helper script does not use the tempdir created by
elasticsearch-env, yet the env script still creates it. This can lead to
lots of temp directories being created when running cli scripts in an
automated fashion. This commit passes a fake tmpdir to the env script to
avoid creation.

closes elastic#34445
rjernst added a commit that referenced this issue May 10, 2019
The elasticsearch-cli helper script does not use the tempdir created by
elasticsearch-env, yet the env script still creates it. This can lead to
lots of temp directories being created when running cli scripts in an
automated fashion. This commit passes a fake tmpdir to the env script to
avoid creation.

closes #34445
rjernst added a commit that referenced this issue May 10, 2019
The elasticsearch-cli helper script does not use the tempdir created by
elasticsearch-env, yet the env script still creates it. This can lead to
lots of temp directories being created when running cli scripts in an
automated fashion. This commit passes a fake tmpdir to the env script to
avoid creation.

closes #34445
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this issue May 27, 2019
The elasticsearch-cli helper script does not use the tempdir created by
elasticsearch-env, yet the env script still creates it. This can lead to
lots of temp directories being created when running cli scripts in an
automated fashion. This commit passes a fake tmpdir to the env script to
avoid creation.

closes elastic#34445
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Plugins Plugin API and infrastructure help wanted adoptme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants