simon
simon

Reputation: 12912

Setting cap_net_bind_service=+ep flag to Java executable changes Tomcat GC logging verbosity in IntelliJ

I am running a Spring Boot 2.7 application on Java 11. Spring Boot 2.7 is using embedded Tomcat 9.0 internally. To troubleshoot a unrelated problem I set the CAP_NET_BIND_SERVICE capability of the Java executable to +ep (effective, permitted) in the operating system using the command

sudo setcap 'cap_net_bind_service=+ep' /usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java

Unfortunately, this seems to change the logging level of the Spring application I run, because the log is suddenly filled with entries like this

"G1 Conc#0" os_prio=0 cpu=20,65ms elapsed=67,04s tid=0x00007f11f8071000 nid=0x2359b runnable  
"G1 Conc#1" os_prio=0 cpu=18,51ms elapsed=64,73s tid=0x00007f11b0001000 nid=0x23607 runnable  
"G1 Conc#2" os_prio=0 cpu=13,68ms elapsed=64,73s tid=0x00007f11b0002000 nid=0x23608 runnable  
"G1 Conc#3" os_prio=0 cpu=20,31ms elapsed=64,73s tid=0x00007f11b0003800 nid=0x23609 runnable  

JNI global refs: 26, weak refs: 0

Heap
 garbage-first heap   total 1032192K, used 28287K [0x0000000418800000, 0x0000000800000000)
  region size 4096K, 7 young (28672K), 3 survivors (12288K)
 Metaspace       used 32491K, capacity 33808K, committed 34048K, reserved 1079296K
  class space    used 4229K, capacity 4763K, committed 4864K, reserved 1048576K

When I remove the CAP_NET_BIND_SERVICE by running

sudo setcap -r /usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java

the logs are displayed without the garbage collector information again.

Why does enabling CAP_NET_BIND_SERVICE for the Java executable change the logging level? How can I prevent this?

What I have attempted:

Upvotes: 1

Views: 670

Answers (0)

Related Questions