-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Upgrade JNA to 5.10.0 #80617
Upgrade JNA to 5.10.0 #80617
Conversation
This commit upgrades JNA to 5.10.0. The primary reason for this upgrade is to adopt a newer version of `libffi` which supports the `LIBFFI_TMPDIR` environment variable so that we can change the location of temporary executables and resolve elastic#77014. This commit also switches to the upstream JNA releases rather than using the specially-repackaged ones we've used in the past.
The two main discussion points are:
|
@elasticmachine please run elasticsearch-ci/part-1 |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
I'll copy my thoughts from our internal Slack discussion about this here. I'm supportive of this change. Historically, we created the custom JNA build for two reasons:
The recompilation of the x86_64 Linux libraries is no longer needed, as JNA upstream reverted their build process so that they could also continue to support the older OS. Therefore, we don't need 1. anymore, and removed that from our custom JNA build. We kept 2. around, but I don't think we should anymore. I think that if we want to take a stance against explicitly not supporting OS that we do not support, it should not be through how we package a dependency, but rather done more explicitly (please note the "if" in that sentence, I'm not taking a stance one way or the other on whether or not we should, only that if we decide that's a stance to take, it shouldn't be done in this way, but more explicitly). Taken together, I do think we should drop our custom JNA build, and use JNA upstream directly. There's a lot of effort that goes into maintaining our custom JNA build, publishing etc. every time we want to bump the version on our upstream dependency, etc., and it's not worth it solely to implicitly indicate lack of support for certain OS/architectures combinations. |
build-tools-internal/build.gradle
Outdated
@@ -211,7 +211,7 @@ dependencies { | |||
api 'com.netflix.nebula:gradle-extra-configurations-plugin:5.0.1' | |||
api 'com.netflix.nebula:gradle-info-plugin:9.2.0' | |||
api 'org.apache.rat:apache-rat:0.11' | |||
api "org.elasticsearch:jna:5.7.0-1" | |||
api 'net.java.dev.jna:jna:5.10.0' |
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.
We should actually just replace this with versions.getProperty('jna')
to avoid having this duplicated in two places.
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.
Thanks, see e58285b
@@ -18,8 +18,8 @@ log4j = 2.11.1 | |||
slf4j = 1.6.2 | |||
ecsLogging = 1.2.0 | |||
|
|||
# when updating the JNA version, also update the version in buildSrc/build.gradle | |||
jna = 5.7.0-1 | |||
# when updating the JNA version, also update the version in build-tools-internal/build.gradle |
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.
If we leverage versions
in the reference build script instead we can ditch this comment since updating it here will update the build script as well.
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.
👍 done in e58285b
👍. Maintaining forks is a big pain, to the degree we can use the original upstream dependencies we should. I don't see compelling motivation to continue to maintain our custom build.
I'm not sure there's any immediate action on this right now. If the upstream dependency "supports" OSes we don't I don't see that as a problem. We don't really strictly enforce any OS requirements right now, so as with other things if it "works" but is unsupported then that's basically the status quo for many other scenarios (i.e. BSD). |
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.
LGTM
server/build.gradle
Outdated
@@ -62,7 +62,7 @@ dependencies { | |||
api "org.apache.logging.log4j:log4j-core:${versions.log4j}", optional | |||
|
|||
// repackaged jna with native bits linked against all elastic supported platforms |
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.
Is this comment now redundant?
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.
Ah so it is, removed in 5a0d091
@elasticmachine please run elasticsearch-ci/part-2 |
This commit upgrades JNA to 5.10.0. The primary reason for this upgrade is to adopt a newer version of `libffi` which supports the `LIBFFI_TMPDIR` environment variable so that we can change the location of temporary executables and resolve elastic#77014. This commit also switches to the upstream JNA releases rather than using the specially-repackaged ones we've used in the past.
This commit upgrades JNA to 5.10.0. The primary reason for this upgrade is to adopt a newer version of `libffi` which supports the `LIBFFI_TMPDIR` environment variable so that we can change the location of temporary executables and resolve elastic#77014. This commit also switches to the upstream JNA releases rather than using the specially-repackaged ones we've used in the past.
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>
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>
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>
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>
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>
* 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>
In elastic#80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
In #80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
In elastic#80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
In elastic#80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
In elastic#80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
In elastic#80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
In #80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
In #80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
In #80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
In #80617 we upgraded to a version of JNA which would report the message `Failed to allocate closure` if the temp dir for `libffi` did not permit executables (rather than crashing with a segfault). This commit extends the docs to mention this message.
由于在 7.16.0 之后使用 JNA 5.10.0 elastic/elasticsearch#80617, 默认编码 `native.encoding` 会是 ASCII-US 这会导致转码问题 (https://github.com/java-native-access/jna/blob/5.10.0/src/com/sun/jna/Native.java#L129C45-L129C45) 故设定对应的编码为 UTF-8 (https://github.com/java-native-access/jna/blob/5.10.0/src/com/sun/jna/Native.java#L846C3-L846C3) 以解决此问题.
This commit upgrades JNA to 5.10.0. The primary reason for this upgrade
is to adopt a newer version of
libffi
which supports theLIBFFI_TMPDIR
environment variable so that we can change the locationof temporary executables and resolve #77014.
This commit also switches to the upstream JNA releases rather than using
the specially-repackaged ones we've used in the past.