Create on behalf of lingjun.cg@alibaba-inc.com
Some Java applications use wildcard classpaths like this:
java -cp "lib/*", JVM expand "lib/*" to concrete a jar list by call readdir() on linux.
But the file order that is returned by readdir() is undefined, it depends on the underlying filesystem.
Suppose this case:
1. Dump AppCDS archive on a host, the classpath expand to: a.jar,b.jar,c.jar...
2. Copy the previous archive to other hosts, then use shared space,
but the classpath may expand to: b.jar:c.jar:a.jar
3. AppCDS check app classpath mismatch and report error
"shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)".
Because of the undefined order of readdir(), so the "lib/*" order is undefined also.
Some Java applications use wildcard classpaths like this:
java -cp "lib/*", JVM expand "lib/*" to concrete a jar list by call readdir() on linux.
But the file order that is returned by readdir() is undefined, it depends on the underlying filesystem.
Suppose this case:
1. Dump AppCDS archive on a host, the classpath expand to: a.jar,b.jar,c.jar...
2. Copy the previous archive to other hosts, then use shared space,
but the classpath may expand to: b.jar:c.jar:a.jar
3. AppCDS check app classpath mismatch and report error
"shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)".
Because of the undefined order of readdir(), so the "lib/*" order is undefined also.
- links to
-
Review openjdk/jdk/17704