1

In my jenkins deployment (for which I am using the official helm chart

        - name: JAVA_OPTS
          value: |
            -Djava.awt.headless=true -Dorg.csanchez.jenkins.plugins.kubernetes.PodTemplate.connectionTimeout=180 -Dhudson.slaves.NodeProvisioner.initialDelay=0 -Xss512k

but when I log in to the pod:

jenkins@jenkins-cd-5f4b845c5d-cd877:/$ java -XX:+PrintFlagsFinal -version | grep ThreadStackSize
     intx CompilerThreadStackSize                   = 0                                   {pd product}
     intx ThreadStackSize                           = 1024                                {pd product}
     intx VMThreadStackSize                         = 1024                                {pd product}

why the -Xss512k has no effect and the ThreadStackSize remains at 1M?

pkaramol
  • 16,451
  • 43
  • 149
  • 324
  • 1
    Things that _run_ java to accomplish a task, like IDEs and databases and Tomcat, sometimes use `JAVA_OPTS` to set options to pass _to_ java on commandline, but java itself (run directly) does not use this envvar; in addition to commandline it uses (reads and parses) `JDK_JAVA_OPTIONS` since j9 (documented) and `_JAVA_OPTIONS JAVA_TOOL_OPTIONS` (undocumented). See https://stackoverflow.com/questions/28327620/difference-between-java-options-java-tool-options-and-java-opts – dave_thompson_085 Aug 13 '20 at 11:46

2 Answers2

0

From Jenkins helm chart documentation Chart

"Additionally, you may want to add env vars for the Jenkins container, and the JVM (master.javaOpts)."

Vlad Ulshin
  • 482
  • 2
  • 5
0

Because your query is showing the default JVM config rather than the one set for your Jenkins.

It is rather a self-proving way to see the affect, you can run the following to get the result, note that the same -Xss512k is added to the query.

java -Xss512k -XX:+PrintFlagsFinal -version | grep ThreadStackSize. 

To see the actual memory configed for the Jenkins instance in the container, you might want to look at JMX (Java Management Extensions).

v.ng
  • 533
  • 5
  • 10