- 
                Notifications
    You must be signed in to change notification settings 
- Fork 25.6k
Set coredump filter for Elasticsearch #137300
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
Conversation
When a linux process dies and the core process memory is dumped, which parts of the memory to output are controlled by the coredump filter. By default the JVM dumps anonymous memory (ie heap and direct memory) and file-backed memory (ie mmaps), and private huge pages. However, the default of dumping file-backed memory for Elasticsearch is problematic; these can be enormous, and they also aren't very useful since the indices will likely be available when investigating the crash. This commit sets the coredump filter when running on Linux to omit file-backed memory from coredumps. Although the JVM has diagnostic VM options for controlling the filter, they end up causing the filter to be inherited, which is from the server CLI, another Java process, which has the file-backed memory bits set. Instead of using the JVM options we set it via the special proc filesystem.
| Pinging @elastic/es-core-infra (Team:Core/Infra) | 
| Note for reviewers: there isn't any easy way to test this. Ideally we could have a packaging test, but the process id we have there is the CLI. So we'll need to look at children of the CLI... | 
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.
One little fix needed (possibly) but LGTM
| // which is the server CLI, which is also a JVM so it has these bits set. Thus, we set it explicitly. | ||
| // See https://man7.org/linux/man-pages/man5/core.5.html for more info on the relevant bits of the filter | ||
| try { | ||
| Files.writeString(Paths.get("/proc/self/coredump_filter"), "0x23"); | 
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.
I think this either needs a @SuppressForbidden or using and alternative (PathUtils?)
When a linux process dies and the core process memory is dumped, which parts of the memory to output are controlled by the coredump filter. By default the JVM dumps anonymous memory (ie heap and direct memory) and file-backed memory (ie mmaps), and private huge pages. However, the default of dumping file-backed memory for Elasticsearch is problematic; these can be enormous, and they also aren't very useful since the indices will likely be available when investigating the crash. This commit sets the coredump filter when running on Linux to omit file-backed memory from coredumps. Although the JVM has diagnostic VM options for controlling the filter, they end up causing the filter to be inherited, which is from the server CLI, another Java process, which has the file-backed memory bits set. Instead of using the JVM options we set it via the special proc filesystem.
When a linux process dies and the core process memory is dumped, which parts of the memory to output are controlled by the coredump filter. By default the JVM dumps anonymous memory (ie heap and direct memory) and file-backed memory (ie mmaps), and private huge pages. However, the default of dumping file-backed memory for Elasticsearch is problematic; these can be enormous, and they also aren't very useful since the indices will likely be available when investigating the crash. This commit sets the coredump filter when running on Linux to omit file-backed memory from coredumps. Although the JVM has diagnostic VM options for controlling the filter, they end up causing the filter to be inherited, which is from the server CLI, another Java process, which has the file-backed memory bits set. Instead of using the JVM options we set it via the special proc filesystem.
When a linux process dies and the core process memory is dumped, which parts of the memory to output are controlled by the coredump filter. By default the JVM dumps anonymous memory (ie heap and direct memory) and file-backed memory (ie mmaps), and private huge pages. However, the default of dumping file-backed memory for Elasticsearch is problematic; these can be enormous, and they also aren't very useful since the indices will likely be available when investigating the crash. This commit sets the coredump filter when running on Linux to omit file-backed memory from coredumps. Although the JVM has diagnostic VM options for controlling the filter, they end up causing the filter to be inherited, which is from the server CLI, another Java process, which has the file-backed memory bits set. Instead of using the JVM options we set it via the special proc filesystem.
When a linux process dies and the core process memory is dumped, which parts of the memory to output are controlled by the coredump filter. By default the JVM dumps anonymous memory (ie heap and direct memory) and file-backed memory (ie mmaps), and private huge pages. However, the default of dumping file-backed memory for Elasticsearch is problematic; these can be enormous, and they also aren't very useful since the indices will likely be available when investigating the crash. This commit sets the coredump filter when running on Linux to omit file-backed memory from coredumps. Although the JVM has diagnostic VM options for controlling the filter, they end up causing the filter to be inherited, which is from the server CLI, another Java process, which has the file-backed memory bits set. Instead of using the JVM options we set it via the special proc filesystem.
When a linux process dies and the core process memory is dumped, which parts of the memory to output are controlled by the coredump filter. By default the JVM dumps anonymous memory (ie heap and direct memory) and file-backed memory (ie mmaps), and private huge pages. However, the default of dumping file-backed memory for Elasticsearch is problematic; these can be enormous, and they also aren't very useful since the indices will likely be available when investigating the crash. This commit sets the coredump filter when running on Linux to omit file-backed memory from coredumps. Although the JVM has diagnostic VM options for controlling the filter, they end up causing the filter to be inherited, which is from the server CLI, another Java process, which has the file-backed memory bits set. Instead of using the JVM options we set it via the special proc filesystem.
When a linux process dies and the core process memory is dumped, which parts of the memory to output are controlled by the coredump filter. By default the JVM dumps anonymous memory (ie heap and direct memory) and file-backed memory (ie mmaps), and private huge pages. However, the default of dumping file-backed memory for Elasticsearch is problematic; these can be enormous, and they also aren't very useful since the indices will likely be available when investigating the crash. This commit sets the coredump filter when running on Linux to omit file-backed memory from coredumps. Although the JVM has diagnostic VM options for controlling the filter, they end up causing the filter to be inherited, which is from the server CLI, another Java process, which has the file-backed memory bits set. Instead of using the JVM options we set it via the special proc filesystem.
When a linux process dies and the core process memory is dumped, which parts of the memory to output are controlled by the coredump filter. By default the JVM dumps anonymous memory (ie heap and direct memory) and file-backed memory (ie mmaps), and private huge pages. However, the default of dumping file-backed memory for Elasticsearch is problematic; these can be enormous, and they also aren't very useful since the indices will likely be available when investigating the crash.
This commit sets the coredump filter when running on Linux to omit file-backed memory from coredumps. Although the JVM has diagnostic VM options for controlling the filter, they end up causing the filter to be inherited, which is from the server CLI, another Java process, which has the file-backed memory bits set. Instead of using the JVM options we set it via the special proc filesystem.