Skip to content

[DOCS] Troubleshooting SIGSEGV on SELinux when elasticsearch home directory is missing#74545

Closed
AndyHunt66 wants to merge 1 commit into7.13from
AndyHunt66-patch-1
Closed

[DOCS] Troubleshooting SIGSEGV on SELinux when elasticsearch home directory is missing#74545
AndyHunt66 wants to merge 1 commit into7.13from
AndyHunt66-patch-1

Conversation

@AndyHunt66
Copy link
Copy Markdown

@AndyHunt66 AndyHunt66 commented Jun 24, 2021

This PR updates docs to guide users who run into this bug: #73309

(The issue is that in some hardened environments, Java tries to write a small file called .oracle_jre_usage to the user's home directory, but if the user has no home directory, there's a very cryptic error.)

@elasticsearchmachine elasticsearchmachine added the external-contributor Pull request authored by a developer outside the Elasticsearch team label Jun 24, 2021
@mark-vieira mark-vieira added the :Core/Infra/Node Lifecycle Node startup, bootstrapping, and shutdown label Jun 25, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jun 25, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@williamrandolph williamrandolph self-requested a review June 28, 2021 20:06
@williamrandolph williamrandolph changed the title Additional troubleshooting steps for jna tmpdir [DOCS] Troubleshooting SIGSEV on SELinux when elasticsearch home directory is missing Jul 14, 2021
@williamrandolph williamrandolph changed the title [DOCS] Troubleshooting SIGSEV on SELinux when elasticsearch home directory is missing [DOCS] Troubleshooting SIGSEGV on SELinux when elasticsearch home directory is missing Jul 14, 2021
@DaveCTurner
Copy link
Copy Markdown
Member

(The issue is that in some hardened environments, Java tries to write a small file called .oracle_jre_usage to the user's home directory, but if the user has no home directory, there's a very cryptic error.)

I believe that's not really the problem - instead it looks like we sometimes use $HOME as a temporary path for executables if we can't find any other path that works. As such, I'd rather fix this with #77014 rather than by making this change.

DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Nov 11, 2021
Today if `libffi` cannot allocate pages of memory which are both
writeable and executable then it will attempt to write code to a
temporary file. Elasticsearch configures itself a suitable temporary
directory for use by JNA but by default `libffi` won't find this
directory and will try various other places. In certain configurations,
none of the other places that `libffi` tries are suitable. With older
versions of JNA this would result in a `SIGSEGV`; since elastic#80617 the JVM
will exit with an exception.

With this commit we use the `LIBFFI_TMPDIR` environment variable to
configure `libffi` to use the same directory as JNA for its temporary
files if they are needed.

Closes elastic#18272
Closes elastic#73309
Closes elastic#74545
Closes elastic#77014
Closes elastic#77053
Relates elastic#77285

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>
DaveCTurner added a commit that referenced this pull request Nov 15, 2021
Today if `libffi` cannot allocate pages of memory which are both
writeable and executable then it will attempt to write code to a
temporary file. Elasticsearch configures itself a suitable temporary
directory for use by JNA but by default `libffi` won't find this
directory and will try various other places. In certain configurations,
none of the other places that `libffi` tries are suitable. With older
versions of JNA this would result in a `SIGSEGV`; since #80617 the JVM
will exit with an exception.

With this commit we use the `LIBFFI_TMPDIR` environment variable to
configure `libffi` to use the same directory as JNA for its temporary
files if they are needed.

Closes #18272
Closes #73309
Closes #74545
Closes #77014
Closes #77053
Relates #77285

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Nov 15, 2021
Today if `libffi` cannot allocate pages of memory which are both
writeable and executable then it will attempt to write code to a
temporary file. Elasticsearch configures itself a suitable temporary
directory for use by JNA but by default `libffi` won't find this
directory and will try various other places. In certain configurations,
none of the other places that `libffi` tries are suitable. With older
versions of JNA this would result in a `SIGSEGV`; since elastic#80617 the JVM
will exit with an exception.

With this commit we use the `LIBFFI_TMPDIR` environment variable to
configure `libffi` to use the same directory as JNA for its temporary
files if they are needed.

Closes elastic#18272
Closes elastic#73309
Closes elastic#74545
Closes elastic#77014
Closes elastic#77053
Relates elastic#77285

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Nov 15, 2021
Today if `libffi` cannot allocate pages of memory which are both
writeable and executable then it will attempt to write code to a
temporary file. Elasticsearch configures itself a suitable temporary
directory for use by JNA but by default `libffi` won't find this
directory and will try various other places. In certain configurations,
none of the other places that `libffi` tries are suitable. With older
versions of JNA this would result in a `SIGSEGV`; since elastic#80617 the JVM
will exit with an exception.

With this commit we use the `LIBFFI_TMPDIR` environment variable to
configure `libffi` to use the same directory as JNA for its temporary
files if they are needed.

Closes elastic#18272
Closes elastic#73309
Closes elastic#74545
Closes elastic#77014
Closes elastic#77053
Relates elastic#77285

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>
elasticsearchmachine pushed a commit that referenced this pull request Nov 15, 2021
Today if `libffi` cannot allocate pages of memory which are both
writeable and executable then it will attempt to write code to a
temporary file. Elasticsearch configures itself a suitable temporary
directory for use by JNA but by default `libffi` won't find this
directory and will try various other places. In certain configurations,
none of the other places that `libffi` tries are suitable. With older
versions of JNA this would result in a `SIGSEGV`; since #80617 the JVM
will exit with an exception.

With this commit we use the `LIBFFI_TMPDIR` environment variable to
configure `libffi` to use the same directory as JNA for its temporary
files if they are needed.

Closes #18272
Closes #73309
Closes #74545
Closes #77014
Closes #77053
Relates #77285

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>
elasticsearchmachine pushed a commit that referenced this pull request Nov 15, 2021
* Set LIBFFI_TMPDIR at startup (#80651)

Today if `libffi` cannot allocate pages of memory which are both
writeable and executable then it will attempt to write code to a
temporary file. Elasticsearch configures itself a suitable temporary
directory for use by JNA but by default `libffi` won't find this
directory and will try various other places. In certain configurations,
none of the other places that `libffi` tries are suitable. With older
versions of JNA this would result in a `SIGSEGV`; since #80617 the JVM
will exit with an exception.

With this commit we use the `LIBFFI_TMPDIR` environment variable to
configure `libffi` to use the same directory as JNA for its temporary
files if they are needed.

Closes #18272
Closes #73309
Closes #74545
Closes #77014
Closes #77053
Relates #77285

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>

* Fix incorrect SSL usage

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Node Lifecycle Node startup, bootstrapping, and shutdown external-contributor Pull request authored by a developer outside the Elasticsearch team Team:Core/Infra Meta label for core/infra team team-discuss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants