Summary
The image currently uses the JRE as the version of Java inside the container. This makes a lot of sense and is IMO the correct choice.
However, that means important debug tools are not available inside the container. These include tools lie jstack and jcmd which can produce thread dumps with more information available from thread dumps generated by Karaf from the console.
Expected Behavior
When a user is experiencing problems, having debug tools to dump the threads and similar can greatly help us diagnose and solve tricky problems like thread locking and such. I would expect these debug tools to be available inside the container.
Current Behavior
jstack and jcmd are not in the image
Possible Solution
Obviously the JDK is huge so installing that just to get these tools is not reasonable. However, @Nadahar found a very small standalone replacement for those tools with jattach.
https://github.com/jattach/jattach
I verified that jattach is in both the Debian repos and the Alpine repos and I experienced no conflicts when I installed it along with everything else that gets installed in the image. The only unknown I have is whether it needs to be installed after the JRE or not. That changes how the Dockerfile for Debian needs to be changed. My hope is it just needs to be added to the first apt install command.
I also verified that jattach works with a running openHAB 5.1.1 instance.
This could also address #449's original issue where @TheNetStriker ran into that problem while attempting to install the JDK to get these very tools inside the container.
Context
We are attempting to identify subtle performance problems for some users running OH with Docker. Access to a threaddump while the user is experiencing the problem will help pinpoint the root cause and fix it.
Summary
The image currently uses the JRE as the version of Java inside the container. This makes a lot of sense and is IMO the correct choice.
However, that means important debug tools are not available inside the container. These include tools lie
jstackandjcmdwhich can produce thread dumps with more information available from thread dumps generated by Karaf from the console.Expected Behavior
When a user is experiencing problems, having debug tools to dump the threads and similar can greatly help us diagnose and solve tricky problems like thread locking and such. I would expect these debug tools to be available inside the container.
Current Behavior
jstackandjcmdare not in the imagePossible Solution
Obviously the JDK is huge so installing that just to get these tools is not reasonable. However, @Nadahar found a very small standalone replacement for those tools with
jattach.https://github.com/jattach/jattach
I verified that
jattachis in both the Debian repos and the Alpine repos and I experienced no conflicts when I installed it along with everything else that gets installed in the image. The only unknown I have is whether it needs to be installed after the JRE or not. That changes how the Dockerfile for Debian needs to be changed. My hope is it just needs to be added to the first apt install command.I also verified that
jattachworks with a running openHAB 5.1.1 instance.This could also address #449's original issue where @TheNetStriker ran into that problem while attempting to install the JDK to get these very tools inside the container.
Context
We are attempting to identify subtle performance problems for some users running OH with Docker. Access to a threaddump while the user is experiencing the problem will help pinpoint the root cause and fix it.