Opensearch ignoring "-XX:-UsePerfData" to disable "perfdata" java feature (to avoid creating "hsperfdata_opensearch" dir in /tmp)

Hi @dtaivpp

I got the root cause of the issue which made us thinking to try default perf location (/tmp) to some other location where user “opensearch” has permissiones. Therefore, we no longer required to change perf location from /tmp to others.

Below are more details:

Trigger point of /tmp related location issues is – “when we run opensearch service on Linux as a user who doesn’t have home dir on executable path”. We start getting JNA error unsatisfied link related.

[2022-04-01T13:00:23,035][WARN ][o.o.b.Natives            ] [osmaster1] unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: /tmp/opensearch-1073614746573548365/jna9916496385695771284.tmp: /tmp/opensearch-1073614746573548365/jna9916496385695771284.tmp: failed to map segment from shared object
        at jdk.internal.loader.NativeLibraries.load(Native Method) ~[?:?]

So, when user doesnt have home dir, opensearch try to use “/tmp” dir for JNA and other stuff. But, since user “opensearch” doesn’t have execute permissions, it throws “unsatisfied link” error.

To try fixing it - we tried io.dir from /tmp to other other location but in that case JVM was crashing.

How to fix it:

Step#1 - Create user e.g. “opensearch” with a home dir on executable path for this user.
For example: Home dir “/opt/opensearch” for user “opensearch” .

Sample command: useradd -r -m -d /opt/opensearch opensearch

Step#2 - install opensearch in this dir /opt/opensearch/
So, your installation will look like /opt/opensearch/opensearch1.4.xx

More details about JNA / Unsatisfied link error I was facing:

Hope this help others facing similar issue.

2 Likes