Use logs dir as working directory#124966
Conversation
In the unexpected case that Elasticsearch dies due to a segfault or other similar native issue, a core dump is useful in diagnosing the problem. Yet core dumps are written to the working directory, which is read-only for most installations of Elasticsearch. This commit changes the working directory to the logs dir which should always be writeable.
|
Hi @rjernst, I've created a changelog YAML for you. |
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
...t/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestTestPluginFuncTest.groovy
Show resolved
Hide resolved
|
|
||
| ReplacementKey heapDumpPathSub; | ||
| if (version.before("8.19.0") && version.onOrAfter("6.3.0")) { | ||
| heapDumpPathSub = new ReplacementKey("-XX:HeapDumpPath=data", ""); |
There was a problem hiding this comment.
I think using "" as fallback is wrong here, every string will contain this fallback leading to unexpected and clearly wrong results when replacing... should this be null or the fallback optional to make the intend clearer in this case?
|
|
||
| ReplacementKey heapDumpPathSub; | ||
| if (version.before("8.19.0") && version.onOrAfter("6.3.0")) { | ||
| heapDumpPathSub = new ReplacementKey("-XX:HeapDumpPath=data", ""); |
There was a problem hiding this comment.
Same as mentioned previously, the "" fallback looks troublesome. I think that needs special handling (and should be more explicit)
💔 Backport failed
You can use sqren/backport to manually backport by running |
|
@rjernst With this change I am seeing a difference in behavior. Previously when invoking elasticsearch with What is the expected behavior for ES when Here is a stack trace that seems to point to the recent change in ES: |
With the change to using the logs dir as the working dir of the Elasticsearch process we need to ensure the logs dir exists within the CLI instead of later during startup. relates elastic#124966
With the change to using the logs dir as the working dir of the Elasticsearch process we need to ensure the logs dir exists within the CLI instead of later during startup. relates #124966
In the unexpected case that Elasticsearch dies due to a segfault or other similar native issue, a core dump is useful in diagnosing the problem. Yet core dumps are written to the working directory, which is read-only for most installations of Elasticsearch. This commit changes the working directory to the logs dir which should always be writeable.
With the change to using the logs dir as the working dir of the Elasticsearch process we need to ensure the logs dir exists within the CLI instead of later during startup. relates elastic#124966
* Use logs dir as working directory (#124966) In the unexpected case that Elasticsearch dies due to a segfault or other similar native issue, a core dump is useful in diagnosing the problem. Yet core dumps are written to the working directory, which is read-only for most installations of Elasticsearch. This commit changes the working directory to the logs dir which should always be writeable. * Ensure logs dir exists before using as working dir (#126566) With the change to using the logs dir as the working dir of the Elasticsearch process we need to ensure the logs dir exists within the CLI instead of later during startup. relates #124966 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
|
This forum thread relates to a curious side-effect of this change if the logs dir is on a slightly weird filesystem that doesn't do permissions right (EFS in that case): the socket for attaching agents to the JVM previously would have been in a tmp directory (as the working directory wasn't writeable) but is now in the working directory, with potentially-messed-up permissions, and thus cannot be used. No action needed, the fix is to make the permissions not be messed up, I'm just linking this thread for interest. |
In the unexpected case that Elasticsearch dies due to a segfault or other similar native issue, a core dump is useful in diagnosing the problem. Yet core dumps are written to the working directory, which is read-only for most installations of Elasticsearch. This commit changes the working directory to the logs dir which should always be writeable.