Skip to content

Commit b842c0c

Browse files
authored
Force urandom on Linux (#102963)
1 parent f15ffc6 commit b842c0c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

distribution/tools/plugin-cli/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* Side Public License, v 1.
77
*/
88

9+
import org.elasticsearch.gradle.OS
10+
911
apply plugin: 'elasticsearch.build'
1012

1113
base {
@@ -38,6 +40,12 @@ tasks.named("dependencyLicenses").configure {
3840
tasks.named("test").configure {
3941
// TODO: find a way to add permissions for the tests in this module
4042
systemProperty 'tests.security.manager', 'false'
43+
// These tests are "heavy" on the secure number generator. On Linux, the NativePRNG defaults to /dev/random for the seeds, and
44+
// its entropy is quite limited, to the point that it's known to hang: https://bugs.openjdk.org/browse/JDK-6521844
45+
// We force the seed to be initialized from /dev/urandom, which is less secure, but in case of unit tests is not important.
46+
if (OS.current() == OS.LINUX) {
47+
systemProperty 'java.security.egd', 'file:/dev/urandom'
48+
}
4149
}
4250

4351
/*

0 commit comments

Comments
 (0)