fabric8io-images / run-java-sh

Universal startup script for plain Java applications
Apache License 2.0
311 stars 88 forks source link

.java_pidXXX in /tmp/ is missing #77

Open haarchri opened 5 years ago

haarchri commented 5 years ago

Hello, we are using a redhat image in openshift with openjdk 1.8 191 (/redhat-openjdk-18/openjdk18-openshift) and we see the issue that the .java_pidXXX in /tmp/ is not generated ... but we need this because instana will look for this .java_pidXXX file

is this issue related to run-java-sh ?

haarchri commented 5 years ago

if we run ./run-java.sh the /tmp/ directory looks like:

  2499070 drwxrwxrwt. 2 root  root          6 Aug  1 13:04 .ICE-unix
 70085240 drwxrwxrwt. 2 root  root          6 Aug  1 13:04 .Test-unix
140677981 drwxrwxrwt. 2 root  root          6 Aug  1 13:04 .X11-unix
  2499071 drwxrwxrwt. 2 root  root          6 Aug  1 13:04 .XIM-unix
204125215 drwxrwxrwt. 2 root  root          6 Aug  1 13:04 .font-unix
 78867050 drwxr-xr-x. 2 jboss root         17 Jan 22 10:31 hsperfdata_jboss
103061014 drwxr-xr-x. 2 root  root         16 Oct 17 21:43 hsperfdata_root
204125216 -rwx------. 1 root  root        836 Aug  1 13:04 ks-script-rCPMxD
210394282 drwxr-xr-x. 2 jboss root          6 Jan 22 10:31 tomcat-docbase.5486201315512238964.9090
 78867068 drwxr-xr-x. 2 jboss root          6 Jan 22 10:31 tomcat-docbase.6374713059548317630.8080
 11019772 drwxr-xr-x. 3 jboss root         18 Jan 22 10:31 tomcat.3131890322825784910.8080
213407262 drwxr-xr-x. 3 jboss root         18 Jan 21 14:40 tomcat.4074043561441405942.8080
142670267 drwxr-xr-x. 3 jboss root         18 Jan 22 10:26 tomcat.4269463323945704072.8080
  6643135 drwxr-xr-x. 3 jboss root         18 Jan 22 10:27 tomcat.5982835558646284788.9090
147274499 drwxr-xr-x. 3 jboss root         18 Jan 22 10:31 tomcat.6503438626708744058.9090
147265532 drwxr-xr-x. 3 jboss root         18 Jan 22 10:30 tomcat.6676762847462312211.9090
 11019763 drwxr-xr-x. 3 jboss root         18 Jan 22 10:30 tomcat.6859392567881366416.8080
 74922116 drwxr-xr-x. 3 jboss root         18 Jan 21 14:37 tomcat.8329898513550039128.8080
147265516 drwxr-xr-x. 3 jboss root         18 Jan 22 10:30 tomcat.8578455417786633705.8080
 22950830 drwxr-xr-x. 3 jboss root         18 Jan 21 14:36 tomcat.8806593142585212724.8080
204125214 -rw-------. 1 root  root          0 Aug  1 13:01 yum.log

if we run the following by "hand" the /tmp/ directory looks like the following: so it looks like because of run-java.sh the .java_pidXXX is missing in /tmp/ but why?

java -cp . -jar /application/test.jar
  2499070 drwxrwxrwt. 2 root  root            6 Aug  1 13:04 .ICE-unix
 70085240 drwxrwxrwt. 2 root  root            6 Aug  1 13:04 .Test-unix
140677981 drwxrwxrwt. 2 root  root            6 Aug  1 13:04 .X11-unix
  2499071 drwxrwxrwt. 2 root  root            6 Aug  1 13:04 .XIM-unix
204125215 drwxrwxrwt. 2 root  root            6 Aug  1 13:04 .font-unix
 11019765 drwxrwxrwx. 2 jboss root         4096 Jan 22 10:31 .instana
 78925344 srw-------. 1 jboss root            0 Jan 22 10:31 .java_pid528
 78867050 drwxr-xr-x. 2 jboss root           17 Jan 22 10:31 hsperfdata_jboss
103061014 drwxr-xr-x. 2 root  root           16 Oct 17 21:43 hsperfdata_root
 78892846 -rwxrwxrwx. 1 root  root       179473 Jan 22 10:31 javaagent-loader-1.3.4.jar
204125216 -rwx------. 1 root  root          836 Aug  1 13:04 ks-script-rCPMxD
210394282 drwxr-xr-x. 2 jboss root            6 Jan 22 10:31 tomcat-docbase.5486201315512238964.9090
 78867068 drwxr-xr-x. 2 jboss root            6 Jan 22 10:31 tomcat-docbase.6374713059548317630.8080
 11019772 drwxr-xr-x. 3 jboss root           18 Jan 22 10:31 tomcat.3131890322825784910.8080
213407262 drwxr-xr-x. 3 jboss root           18 Jan 21 14:40 tomcat.4074043561441405942.8080
142670267 drwxr-xr-x. 3 jboss root           18 Jan 22 10:26 tomcat.4269463323945704072.8080
  6643135 drwxr-xr-x. 3 jboss root           18 Jan 22 10:27 tomcat.5982835558646284788.9090
147274499 drwxr-xr-x. 3 jboss root           18 Jan 22 10:31 tomcat.6503438626708744058.9090
147265532 drwxr-xr-x. 3 jboss root           18 Jan 22 10:30 tomcat.6676762847462312211.9090
 11019763 drwxr-xr-x. 3 jboss root           18 Jan 22 10:30 tomcat.6859392567881366416.8080
 74922116 drwxr-xr-x. 3 jboss root           18 Jan 21 14:37 tomcat.8329898513550039128.8080
147265516 drwxr-xr-x. 3 jboss root           18 Jan 22 10:30 tomcat.8578455417786633705.8080
 22950830 drwxr-xr-x. 3 jboss root           18 Jan 21 14:36 tomcat.8806593142585212724.8080
204125214 -rw-------. 1 root  root            0 Aug  1 13:01 yum.log
rhuss commented 5 years ago

That's a good question. I don't think we use a dedicated option to suppress the generation of this file, but could be wrong. But you are right, its the way how run-java.sh starts the JVM, so it would be good to post here the first line of the logs when starting the JVM as this contains information with which options the JVM has been called.

haarchri commented 5 years ago

hello, i edited the run-java.sh - i removed the exec then the .java_pidXXX is available

old:

  echo exec $(get_exec_args) java $(get_java_options) -cp "$(get_classpath)" ${args} $*
  exec $(get_exec_args) java $(get_java_options) -cp "$(get_classpath)" ${args} $*

new:

  echo java $(get_java_options) -cp "$(get_classpath)" ${args} $*
  java $(get_java_options) -cp "$(get_classpath)" ${args} $*