Elasticsearch appears to ignore -XX:+UseG1GC in jvm.options

This line indicates that /etc/elasticsearch/jvm.options is being parsed:

+++ grep '^-' /etc/elasticsearch/jvm.options

This line indicates that -XX:+UseG1GC is not in that file:

++ echo '-Xms4g -Xmx4g -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps '

Are you sure that you're placing the -XX:+UseG1GC in the right file? Are you sure that it's in /etc/elasticsearch/jvm.options?

Note that earlier you shared a gist that showed the heap size being set to 30g yet the output here shows 4g as the heap size. Are we really looking at the right file?

Or do you maybe have an automated process that is replacing /etc/elastcisearch/jvm.options, for example Puppet or some other process that is getting in the way here?