Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarkus 3.13 app fails to start inside folder with special symbols in name #42248

Closed
fedinskiy opened this issue Jul 31, 2024 · 16 comments
Closed
Assignees
Labels
area/config kind/bug Something isn't working

Comments

@fedinskiy
Copy link
Contributor

fedinskiy commented Jul 31, 2024

Describe the bug

I have an app which is stored inside folder, which contains special symbols in name. After update from 3.11.0 to 3.13.0 the app fails to start

Quarkus 3.12.3 application works fine, the regression happens with Quarkus 3.13.0.

Expected behavior

The app starts

Actual behavior

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:62)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:33)
Caused by: java.lang.ExceptionInInitializerError
	at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1160)
	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:300)
	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor(MethodHandleAccessorFactory.java:103)
	at java.base/jdk.internal.reflect.ReflectionFactory.newConstructorAccessor(ReflectionFactory.java:200)
	at java.base/java.lang.reflect.Constructor.acquireConstructorAccessor(Constructor.java:549)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	... 3 more
Caused by: java.io.UncheckedIOException: Failed to read /home/fedinsky/code/quarkus/refresh/get
	at io.smallrye.common.classloader.ClassPathUtils.processAsJarPath(ClassPathUtils.java:188)
	at io.smallrye.common.classloader.ClassPathUtils.processAsPath(ClassPathUtils.java:150)
	at io.smallrye.common.classloader.ClassPathUtils.consumeAsPath(ClassPathUtils.java:102)
	at io.smallrye.common.classloader.ClassPathUtils.consumeAsPaths(ClassPathUtils.java:86)
	at io.smallrye.config.AbstractLocationConfigSourceLoader.tryClassPath(AbstractLocationConfigSourceLoader.java:141)
	at io.smallrye.config.AbstractLocationConfigSourceLoader.loadConfigSources(AbstractLocationConfigSourceLoader.java:104)
	at io.smallrye.config.AbstractLocationConfigSourceLoader.loadConfigSources(AbstractLocationConfigSourceLoader.java:87)
	at io.smallrye.config.PropertiesConfigSourceLoader$InClassPath.getConfigSources(PropertiesConfigSourceLoader.java:47)
	at io.smallrye.config.PropertiesConfigSourceLoader.inClassPath(PropertiesConfigSourceLoader.java:33)
	at io.smallrye.config.SmallRyeConfigBuilder.getPropertiesSources(SmallRyeConfigBuilder.java:217)
	at io.smallrye.config.SmallRyeConfigBuilder.getDefaultSources(SmallRyeConfigBuilder.java:200)
	at io.smallrye.config.SmallRyeConfig$ConfigSources.buildSources(SmallRyeConfig.java:841)
	at io.smallrye.config.SmallRyeConfig$ConfigSources.<init>(SmallRyeConfig.java:770)
	at io.smallrye.config.SmallRyeConfig.<init>(SmallRyeConfig.java:85)
	at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:736)
	at io.quarkus.runtime.generated.Config.<clinit>(Unknown Source)
	... 17 more
Caused by: java.nio.file.NoSuchFileException: /home/fedinsky/code/quarkus/refresh/get
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:166)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getZipFileSystem(ZipFileSystemProvider.java:125)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:120)
	at io.smallrye.common.classloader.ClassPathUtils.processAsJarPath(ClassPathUtils.java:164)
	... 32 more

How to Reproduce?

  1. Check the folder:
$ pwd
/home/fedinsky/code/quarkus/refresh
  1. Create and build the app:
mvn io.quarkus.platform:quarkus-maven-plugin:3.13.0:create -DprojectGroupId=my-groupId -DprojectArtifactId=app -DprojectVersion=1.0.0-SNAPSHOT -DpackageName=org.my.group -DquarkusRegistryClient=false -DplatformVersion=3.13.0 -Dextensions=quarkus-rest && cd app
mvn clean compile quarkus:build
java -jar target/quarkus-app/quarkus-run.jar  # the app starts
  1. Move the app into folder with special symbols:
cd ..
mkdir ',;~!@#$%^&()' # name 'get!up' works for this purpose as well. name 'inner' doesn't
cp -r app/ ',;~!@#$%^&()'
 cd ',;~!@#$%^&()'/app
java -jar target/quarkus-app/quarkus-run.jar # the app fails

Output of uname -a or ver

6.7.3-200.fc39.x86_64

Output of java -version

Java version: 21.0.1, vendor: Eclipse Adoptium

Quarkus version or git rev

3.13.0

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)

Additional information

No response

@fedinskiy fedinskiy added the kind/bug Something isn't working label Jul 31, 2024
@fedinskiy fedinskiy changed the title Quarkus app fail to start inside folder with special symbols Quarkus app fails to start inside folder with special symbols in name Jul 31, 2024
Copy link

quarkus-bot bot commented Aug 1, 2024

/cc @radcortez (config)

fedinskiy added a commit to fedinskiy/quarkus-startstop that referenced this issue Aug 1, 2024
- Change all dependencies to the latest versions
- Add a bit of debugging related to quarkusio/quarkus#42237 and quarkusio/quarkus#42248
- After 3.13.0 quarkus OTEL exporter uses GRPC streams to export traces.
  Our hacked together OTEL server could not handle that and was rewritten to conform to OTEL specifications more.
fedinskiy added a commit to fedinskiy/quarkus-startstop that referenced this issue Aug 1, 2024
- Change all dependencies to the latest versions
- Add a bit of debugging related to quarkusio/quarkus#42237 and quarkusio/quarkus#42248
- After 3.13.0 quarkus OTEL exporter uses GRPC streams to export traces.
  Our hacked together OTEL server could not handle that and was rewritten to conform to OTEL specifications more.
fedinskiy added a commit to fedinskiy/quarkus-startstop that referenced this issue Aug 5, 2024
- Change all dependencies to the latest versions
- Add a bit of debugging related to quarkusio/quarkus#42237 and quarkusio/quarkus#42248
- After 3.13.0 quarkus OTEL exporter uses GRPC streams to export traces.
  Our hacked together OTEL server could not handle that and was rewritten to conform to OTEL specifications more.
fedinskiy added a commit to fedinskiy/quarkus-startstop that referenced this issue Aug 5, 2024
- Change all dependencies to the latest versions
- Add a bit of debugging related to quarkusio/quarkus#42237 and quarkusio/quarkus#42248
- After 3.13.0 quarkus OTEL exporter uses GRPC streams to export traces.
  Our hacked together OTEL server could not handle that and was rewritten to conform to OTEL specifications more.
fedinskiy added a commit to fedinskiy/quarkus-startstop that referenced this issue Aug 5, 2024
- Change all dependencies to the latest versions
- Add a bit of debugging related to quarkusio/quarkus#42237 and quarkusio/quarkus#42248
- After 3.13.0 quarkus OTEL exporter uses GRPC streams to export traces.
  Our hacked together OTEL server could not handle that and was rewritten to conform to OTEL specifications more.
@rsvoboda
Copy link
Member

rsvoboda commented Aug 6, 2024

@fedinskiy can you findount which concrete version introduced the break, currently you say "After update from 3.11.0 to 3.13.0" in the description and that's quite wide range.

@rsvoboda
Copy link
Member

rsvoboda commented Aug 6, 2024

@fedinskiy no need, I played with this and the regression starts with Quarkus 3.13.0

Quarkus 3.12.3 works fine.

mkdir 'get!up'
cd 'get!up'

mvn io.quarkus.platform:quarkus-maven-plugin:3.12.3:create -DprojectGroupId=my-groupId -DprojectArtifactId=app-3.12.3 -DprojectVersion=1.0.0-SNAPSHOT -DpackageName=org.my.group -DquarkusRegistryClient=false -DplatformVersion=3.12.3 -Dextensions=quarkus-rest
mvn clean package -f app-3.12.3
java -jar app-3.12.3/target/quarkus-app/quarkus-run.jar

@rsvoboda rsvoboda changed the title Quarkus app fails to start inside folder with special symbols in name Quarkus 3.13 app fails to start inside folder with special symbols in name Aug 6, 2024
@gaol
Copy link
Contributor

gaol commented Aug 6, 2024

Looks like relates to smallrye/smallrye-common#293, which added the support of nested jar inside jar in smallrye-common.

@dmlloyd
Copy link
Member

dmlloyd commented Aug 26, 2024

I'll take a look at this. But I think the answer might end up being "! is disallowed in file names" or possibly "! cannot be the last character in the file name" at best.

@maxandersen
Copy link
Member

@dmlloyd is it only ! that makes it fail even today?

@dmlloyd
Copy link
Member

dmlloyd commented Aug 27, 2024

I believe so, yes.

@dmlloyd
Copy link
Member

dmlloyd commented Aug 27, 2024

This should be fixed (for the most part) by smallrye/smallrye-common#337, which will only recognize ! if it is before a separator. Having a file called foo.jar! will still confuse it, but that seems acceptible.

@rsvoboda
Copy link
Member

rsvoboda commented Aug 28, 2024

Thanks, I tried sample app in get!up directory with io.smallrye.common:smallrye-common-classloader:2.6.0-SNAPSHOT on classpath and java -jar command works.

I tried get!up! directory (which was mentioned to be problematic as ! is at the end) and mvn clean package command fails with quarkus-maven-plugin:build step with [ERROR] Caused by: java.nio.file.NoSuchFileException: /Users/rsvoboda/Downloads/get!up!/target/quarkus-app/quarkus/transformed-bytecode.jar

Unexpected file gets created in the directory one level above named get!up, it's a JAR file.

Screenshot 2024-08-28 at 15 35 06

@dmlloyd
Copy link
Member

dmlloyd commented Aug 29, 2024

OK I can see if we can prevent the zipfs from creating a file if it doesn't exist.

@rsvoboda
Copy link
Member

@dmlloyd I tried to build the latest 2.6.0-SNAPSHOT and use in the app. Unfortunately mvn clean package -e in getup! directory still fails and unexpected ZIP/JAR file is created in the directory one level above.

Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.deployment.pkg.steps.JarResultBuildStep#buildRunnerJar threw an exception: java.lang.reflect.UndeclaredThrowableException
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:860)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
	at java.base/java.lang.Thread.run(Thread.java:1583)
	at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: java.nio.file.NoSuchFileException: /Users/rsvoboda/Downloads/getup!/target/quarkus-app/quarkus/transformed-bytecode.jar
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
	at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:171)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1853)
	at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1445)
	at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:724)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:251)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:180)
	at java.base/java.util.jar.JarFile.<init>(JarFile.java:345)
	at java.base/java.util.jar.JarFile.<init>(JarFile.java:316)
	at java.base/java.util.jar.JarFile.<init>(JarFile.java:282)
	at io.quarkus.bootstrap.runner.SerializedApplication.writeJar(SerializedApplication.java:183)
	at io.quarkus.bootstrap.runner.SerializedApplication.write(SerializedApplication.java:75)
	at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildThinJar(JarResultBuildStep.java:773)
	at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildRunnerJar(JarResultBuildStep.java:228)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:854)
	... 7 more

    at io.quarkus.builder.Execution.run (Execution.java:123)
    at io.quarkus.builder.BuildExecutionBuilder.execute (BuildExecutionBuilder.java:79)
    at io.quarkus.deployment.QuarkusAugmentor.run (QuarkusAugmentor.java:163)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment (AugmentActionImpl.java:350)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.createProductionApplication (AugmentActionImpl.java:178)
    at io.quarkus.maven.BuildMojo.doExecute (BuildMojo.java:139)
    at io.quarkus.maven.QuarkusBootstrapMojo.execute (QuarkusBootstrapMojo.java:171)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: java.lang.reflect.UndeclaredThrowableException
    at io.quarkus.deployment.ExtensionLoader$3.execute (ExtensionLoader.java:860)
    at io.quarkus.builder.BuildContext.run (BuildContext.java:256)
    at org.jboss.threads.ContextHandler$1.runWith (ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith (EnhancedQueueExecutor.java:2516)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run (EnhancedQueueExecutor.java:2495)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run (EnhancedQueueExecutor.java:1521)
    at java.lang.Thread.run (Thread.java:1583)
    at org.jboss.threads.JBossThread.run (JBossThread.java:483)
Caused by: java.nio.file.NoSuchFileException: /Users/rsvoboda/Downloads/getup!/target/quarkus-app/quarkus/transformed-bytecode.jar
    at sun.nio.fs.UnixException.translateToIOException (UnixException.java:92)
    at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:106)
    at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:111)
    at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes (UnixFileAttributeViews.java:55)
    at sun.nio.fs.UnixFileSystemProvider.readAttributes (UnixFileSystemProvider.java:171)
    at java.nio.file.Files.readAttributes (Files.java:1853)
    at java.util.zip.ZipFile$Source.get (ZipFile.java:1445)
    at java.util.zip.ZipFile$CleanableResource.<init> (ZipFile.java:724)
    at java.util.zip.ZipFile.<init> (ZipFile.java:251)
    at java.util.zip.ZipFile.<init> (ZipFile.java:180)
    at java.util.jar.JarFile.<init> (JarFile.java:345)
    at java.util.jar.JarFile.<init> (JarFile.java:316)
    at java.util.jar.JarFile.<init> (JarFile.java:282)
    at io.quarkus.bootstrap.runner.SerializedApplication.writeJar (SerializedApplication.java:183)
    at io.quarkus.bootstrap.runner.SerializedApplication.write (SerializedApplication.java:75)
    at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildThinJar (JarResultBuildStep.java:773)
    at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildRunnerJar (JarResultBuildStep.java:228)
    at java.lang.invoke.MethodHandle.invokeWithArguments (MethodHandle.java:733)
    at io.quarkus.deployment.ExtensionLoader$3.execute (ExtensionLoader.java:854)
    at io.quarkus.builder.BuildContext.run (BuildContext.java:256)
    at org.jboss.threads.ContextHandler$1.runWith (ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith (EnhancedQueueExecutor.java:2516)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run (EnhancedQueueExecutor.java:2495)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run (EnhancedQueueExecutor.java:1521)
    at java.lang.Thread.run (Thread.java:1583)
    at org.jboss.threads.JBossThread.run (JBossThread.java:483)

@dmlloyd
Copy link
Member

dmlloyd commented Aug 30, 2024

What file is being created? I wonder if this code previously relied on the hidden side-effect of creating a file...?

@dmlloyd
Copy link
Member

dmlloyd commented Aug 30, 2024

Also I think the code that fails now might not be related to what was failing before. At least there's a chance of that.

dmlloyd added a commit to dmlloyd/quarkus that referenced this issue Aug 30, 2024
@rsvoboda
Copy link
Member

rsvoboda commented Sep 2, 2024

Running mvn clean package -e in ~/Downloads/getup! directory

Message: Caused by: java.nio.file.NoSuchFileException: /Users/rsvoboda/Downloads/getup!/target/quarkus-app/quarkus/transformed-bytecode.jar

~/Downloads/getup gets created, probably instead of transformed-bytecode.jar

file ~/Downloads/getup\! 
/Users/rsvoboda/Downloads/getup!: directory

file ~/Downloads/getup
/Users/rsvoboda/Downloads/getup: Zip archive data, at least v1.0 to extract, compression method=store

Update SmallRye Common to 2.6.0 #42918 fixes the case when ! is not the last character in the directory name, maybe I create new issue for ! as the last character so this issue can be close. Agree @dmlloyd ?

gsmet pushed a commit to gsmet/quarkus that referenced this issue Sep 2, 2024
Fixes quarkusio#42858. Fixes part of quarkusio#42248.

(cherry picked from commit 7caa6d5)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Sep 3, 2024
Fixes quarkusio#42858. Fixes part of quarkusio#42248.

(cherry picked from commit 7caa6d5)
@dmlloyd
Copy link
Member

dmlloyd commented Sep 3, 2024

Sure, that works for me. Thanks.

@rsvoboda
Copy link
Member

Closing, #43273 was created for the case with ! at the end. This fail is not related to the change done in smallrye/smallrye-common#293

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants