Scrivio Interview library
DebuggingIntermediate7 min read · updated 12 November 2026

After upgrading from JDK 11 to JDK 21, a service fails at startup with an Unrecognized VM option error for an old GC-related flag it has used for years. What happened, what do you do, and how do you prevent this?

HotSpot retires flags in stages: a flag is first deprecated (it still works, with a warning), then made obsolete (accepted but ignored, with a warning), and finally expired, after which the JVM refuses to start with Unrecognized VM option. On JDK 11 the old GC flag was probably already obsolete and silently ignored with a warning nobody read; by JDK 21 it had expired. We remove the flag, check whether what it was trying to achieve still matters on the new JDK, avoid -XX:+IgnoreUnrecognizedVMOptions, and prevent a repeat by starting every service with its real production flags on the target JDK in CI before the upgrade.

Why this question is asked

JDK upgrades are routine work, and a service that will not start after one is a common and embarrassing failure, often discovered during a production rollout. The error itself is easy to fix, but the interviewer wants to see that we understand why it happened, that we do not reach for a dangerous workaround, and that we change the process so it does not happen again across the fleet. In this answer, we will reproduce the error, explain the life cycle of a HotSpot flag, see why CMS-era flags are the usual culprits, decide what to do with the flag, look at why IgnoreUnrecognizedVMOptions is a trap, and set up a CI check that catches this before the upgrade.

1Reproducing the Failure

Suppose a service has started for years with a set of GC options written when it ran on JDK 8. On JDK 11 it printed a warning at startup, which ended up in the log and was ignored. On JDK 21 the same command line fails before any application code runs.

Java
# JDK 11: starts, with a warning on stderr
java -XX:+UseParNewGC -jar pricing.jar
# OpenJDK 64-Bit Server VM warning: Ignoring option UseParNewGC; support was removed in 10.0
# JDK 21: does not start
java -XX:+UseParNewGC -jar pricing.jar
# Unrecognized VM option 'UseParNewGC'
# Error: Could not create the Java Virtual Machine.
# Error: A fatal exception has occurred. Program will exit.

The exact flag and the release where each stage happened differ from flag to flag, so check your version's release notes for the one in your script. The pattern, though, is always the same: a flag that was quietly ignored becomes a hard error.

2How HotSpot Retires a Flag

OpenJDK does not remove flags in one step, because that would break command lines without warning. Each flag goes through a documented life cycle. While it is deprecated, it still works but prints a warning. When it becomes obsolete, the JVM accepts it, prints Ignoring option ... support was removed, and does nothing with it. When it expires, the JVM no longer knows the name at all and treats it like a typo: Unrecognized VM option, and startup fails.

Step throughLife of a retired HotSpot flag
  1. Supportedworks, no message
  2. Deprecatedstill works, prints a deprecation warning
  3. Obsoleteaccepted but ignored: Ignoring option X; support was removed
  4. Expiredunknown name: Unrecognized VM option, JVM exits

4 steps in order. Play them, or step through them one at a time.

Each stage usually lasts one or more releases; the warning stages are the chance to clean up.

So the service did not break suddenly. It had been warning us since the flag became deprecated, and for the whole of JDK 11 the flag was doing nothing. The upgrade only turned a silent no-op into a failure.

3Why GC Flags Are the Usual Culprits

Many expired flags belong to features that no longer exist. The Concurrent Mark Sweep collector (CMS) was deprecated in JDK 9 and removed in JDK 14, and with it went UseConcMarkSweepGC, the CMS tuning flags and the ParNew young collector that worked with it. The old GC logging flags such as PrintGCDateStamps were replaced by unified logging (-Xlog) in JDK 9. Other flags were removed because the JVM now does the job better by itself.

A service that started on JDK 8 with a tuning list copied from a CMS-era article therefore carries several flags that point at nothing. Some of them fail loudly at some release, while others are still in the obsolete stage and print warnings. It is worth finding all of them at once rather than one per upgrade.

4What We Do With the Flag

The immediate fix is to remove the flag. But before deleting it we ask what it was for, because the goal may still matter. UseParNewGC and the CMS flags were there to get short pauses with the CMS collector. On JDK 21 the default collector, G1, already aims for a 200 ms pause target, and if the service really needs lower pauses, ZGC is the modern answer. In most cases the default is fine and the right change is to delete the whole CMS block and measure.

Text
# before (JDK 8 era)
-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=70
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:/logs/gc.log
# after (JDK 21): defaults plus logging in the unified format
-Xlog:gc*:file=/logs/gc.log:time,uptime,level,tags:filecount=5,filesize=20m

Notice that the logging intent survives: we still want a GC log, so we translate it to -Xlog rather than dropping it. The collector tuning does not survive, because it tuned a collector that no longer exists. After the change we compare GC logs and latency under load with the old JDK to confirm nothing got worse.

5Why Not -XX:+IgnoreUnrecognizedVMOptions?

There is a flag that makes the JVM skip unknown options instead of failing. It makes the error disappear, and that is the problem. It also hides genuine mistakes: a typo such as -XX:MaxRAMPrecentage=75 would be silently ignored, and the service would run with a 25 percent heap while everyone believes it has 75. The failure moves from a clear startup error to a slow, confusing production problem.

The startup error is the JVM doing us a favour. We want unknown flags to fail, and we want that failure early, which leads to the prevention step.

6Preventing It: Start Every Service on the Target JDK in CI

The cheapest place to find an expired flag is a CI job that runs before the upgrade. For each service, take the exact production JVM options, including those from the base image and environment variables, and start the JVM with them on the target JDK. A simple check is to run java with those options and -version and fail on any Unrecognized VM option, and also fail on Ignoring option and deprecation warnings so we clean up while the flag is still harmless.

Java
# CI step: run the production options against the next JDK
OPTS="$(cat deploy/jvm.options)"
/opt/jdk-25/bin/java $OPTS -version 2> jvm-check.txt || { cat jvm-check.txt; exit 1; }
grep -E 'Ignoring option|deprecated|Unrecognized' jvm-check.txt && exit 1 # fail on warnings too
echo "JVM options OK on JDK 25"

Better still is a smoke test that starts the whole service on the new JDK, because some problems appear only when the application runs. With this check in place, the next LTS upgrade becomes a list of warnings to fix weeks ahead instead of a failed deployment.

7Follow-up questions

Why did nobody notice on JDK 11?

Because an obsolete flag only produces a warning on stderr at startup and the service works normally. In a busy log, nobody reads the first lines. Making CI fail on these warnings turns them into something a person has to act on.

How do I find out in which release a flag was removed?

Check the release notes of each JDK version between the old and the new one; they list deprecated, obsoleted and expired flags. Running the options on each intermediate JDK with -version also shows the warning text, which names the release where support was removed.

Can a flag that still exists change meaning?

Yes, defaults and behaviour can change without the name disappearing. That is why the CI check should be paired with a performance comparison, such as a load test with GC logs on both JDKs, before the rollout.

8Conclusion

In this answer, we saw that HotSpot flags go through deprecation, obsolescence and expiry, so the old GC flag had been ignored on JDK 11 and finally became an Unrecognized VM option on JDK 21. CMS-era flags are the usual culprits because the features they tuned were removed. We remove the flag after checking whether its purpose still matters, translate intents like GC logging to the new form, avoid IgnoreUnrecognizedVMOptions because it hides real typos, and add a CI step that starts every service with its production options on the target JDK.

What to say in the interviewAbout 90 seconds aloud

Open with

What happened is the normal life cycle of a HotSpot flag. Flags are first deprecated, which still works with a warning, then obsoleted, where the JVM accepts the flag but ignores it with an Ignoring option, support was removed warning, and finally expired, where the name is unknown and the JVM refuses to start with Unrecognized VM option.

Then, if they want more

So on JDK 11 this flag was probably already doing nothing, and the warning sat unread at the top of the log. GC flags are the classic case, because CMS and ParNew were removed in JDK 14 and the old GC logging flags were replaced by unified logging.

To fix it, I remove the flag, but first I ask what it was meant to achieve. Usually it was CMS tuning, and on G1 the default is fine, so I delete the whole block and translate the parts that still matter, like the GC log, into -Xlog, then compare GC behaviour and latency under load.

I would not use IgnoreUnrecognizedVMOptions, because it also hides genuine typos, like a misspelled MaxRAMPercentage. To prevent it, CI starts every service with its real production options, including the base image ones, on the target JDK before the upgrade, and fails on unrecognized options and on the ignoring and deprecation warnings too.

About this answer

Last updated
12 November 2026
Versions it names
Java 21, Java 11, Java 8, Java 9
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "After upgrading from JDK 11 to JDK 21, a service fails at startup with an Unrecognized...": https://scrivio-interview-library.netlify.app/java/jvm-tuning/3f115080ef/