Skip to content

Commit 2ab6099

Browse files
committed
Configure heap dump path for archive packages (#29130)
This is a follow up to a previous change which set the heap dump path for the package distributions. The observation here is that we always set the working directory of Elasticsearch to to the root of installation (i.e., Elasticsearch home). Therefore, we can specify the heap dump path relative to this directory and default it to the data directory, similar to the package distributions.
1 parent 8328a87 commit 2ab6099

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

distribution/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ subprojects {
262262
'heap.dump.path': [
263263
'deb': "-XX:HeapDumpPath=/var/lib/elasticsearch",
264264
'rpm': "-XX:HeapDumpPath=/var/lib/elasticsearch",
265-
'def': "#-XX:HeapDumpPath=/heap/dump/path"
265+
'def': "-XX:HeapDumpPath=data"
266266
],
267267

268268
'error.file': [

distribution/src/config/jvm.options

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
# heap dumps are created in the working directory of the JVM
7878
-XX:+HeapDumpOnOutOfMemoryError
7979

80-
# specify an alternative path for heap dumps
81-
# ensure the directory exists and has sufficient space
80+
# specify an alternative path for heap dumps; ensure the directory exists and
81+
# has sufficient space
8282
${heap.dump.path}
8383

8484
# specify an alternative path for JVM fatal error logs
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
[[heap-dump-path]]
22
=== JVM heap dump path
33

4-
The <<rpm,RPM>> and <<deb,Debian>> package distributions default to configuring
5-
the JVM to dump the heap on out of memory exceptions to
6-
`/var/lib/elasticsearch`. If this path is not suitable for storing heap dumps,
7-
you should modify the entry `-XX:HeapDumpPath=/var/lib/elasticsearch` in
8-
<<jvm-options,`jvm.options`>> to an alternate path. If you specify a filename
9-
instead of a directory, the JVM will repeatedly use the same file; this is one
10-
mechanism for preventing heap dumps from accumulating in the heap dump path.
11-
Alternatively, you can configure a scheduled task via your OS to remove heap
12-
dumps that are older than a configured age.
13-
14-
Note that the archive distributions do not configure the heap dump path by
15-
default. Instead, the JVM will default to dumping to the working directory for
16-
the Elasticsearch process. If you wish to configure a heap dump path, you should
17-
modify the entry `#-XX:HeapDumpPath=/heap/dump/path` in
18-
<<jvm-options,`jvm.options`>> to remove the comment marker `#` and to specify an
19-
actual path.
4+
By default, Elasticsearch configures the JVM to dump the heap on out of
5+
memory exceptions to the default data directory (this is
6+
`/var/lib/elasticsearch` for the <<rpm,RPM>> and <<deb,Debian>> package
7+
distributions, and the `data` directory under the root of the
8+
Elasticsearch installation for the <<zip-targz,tar and zip>> archive
9+
distributions). If this path is not suitable for receiving heap dumps,
10+
you should modify the entry `-XX:HeapDumpPath=...` in
11+
<<jvm-options,`jvm.options`>>. If you specify a fixed filename instead
12+
of a directory, the JVM will repeatedly use the same file; this is one
13+
mechanism for preventing heap dumps from accumulating in the heap dump
14+
path. Alternatively, you can configure a scheduled task via your OS to
15+
remove heap dumps that are older than a configured age.

0 commit comments

Comments
 (0)