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

Jetty 12: stopping the app fails with java.nio.file.ClosedFileSystemException #20

Closed
mvysny opened this issue Jul 21, 2023 · 3 comments
Closed
Assignees
Labels
blocked by upstream Something needs to be fixed in another library first bug Something isn't working

Comments

@mvysny
Copy link
Owner

mvysny commented Jul 21, 2023

Stopping the vaadin-boot app fails with:

2023-07-21 14:45:24.199 [main] INFO com.github.mvysny.vaadinboot.VaadinBoot - Main: Shutting down
2023-07-21 14:45:24.210 [main] INFO com.example.Bootstrap - Testapp shut down
2023-07-21 14:45:24.214 [main] ERROR com.github.mvysny.vaadinboot.VaadinBoot - stop() failed: java.nio.file.ClosedFileSystemException
java.nio.file.ClosedFileSystemException
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.ensureOpen(ZipFileSystem.java:1628)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.checkAccess(ZipFileSystem.java:560)
	at jdk.zipfs/jdk.nio.zipfs.ZipPath.checkAccess(ZipPath.java:892)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.checkAccess(ZipFileSystemProvider.java:172)
	at java.base/java.nio.file.Files.isAccessible(Files.java:2597)
	at java.base/java.nio.file.Files.isReadable(Files.java:2632)
	at org.eclipse.jetty.util.resource.PathResource.isReadable(PathResource.java:307)
	at org.eclipse.jetty.util.resource.Resources.isReadable(Resources.java:79)
	at org.eclipse.jetty.server.handler.ContextHandler.setBaseResource(ContextHandler.java:884)
	at org.eclipse.jetty.ee10.webapp.WebInfConfiguration.deconfigure(WebInfConfiguration.java:99)
	at org.eclipse.jetty.ee10.webapp.WebAppContext.stopContext(WebAppContext.java:1222)
	at org.eclipse.jetty.ee10.servlet.ServletContextHandler.doStop(ServletContextHandler.java:1070)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
	at org.eclipse.jetty.server.Handler$Abstract.doStop(Handler.java:403)
	at org.eclipse.jetty.server.Server.doStop(Server.java:648)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
	at com.github.mvysny.vaadinboot.VaadinBoot.stop(VaadinBoot.java:366)
	at com.github.mvysny.vaadinboot.VaadinBoot.run(VaadinBoot.java:260)
	at com.example.Main.main(Main.java:7)
2023-07-21 14:45:24.215 [Thread-19] INFO com.github.mvysny.vaadinboot.VaadinBoot - Shutdown hook called, shutting down
2023-07-21 14:45:24.216 [Thread-19] ERROR com.github.mvysny.vaadinboot.VaadinBoot - stop() failed: java.lang.NullPointerException: Cannot invoke "javax.naming.Context.destroySubcontext(String)" because "compCtx" is null
java.lang.NullPointerException: Cannot invoke "javax.naming.Context.destroySubcontext(String)" because "compCtx" is null
	at org.eclipse.jetty.ee10.plus.webapp.EnvConfiguration.deconfigure(EnvConfiguration.java:165)
	at org.eclipse.jetty.ee10.webapp.WebAppContext.stopContext(WebAppContext.java:1222)
	at org.eclipse.jetty.ee10.servlet.ServletContextHandler.doStop(ServletContextHandler.java:1070)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
	at org.eclipse.jetty.server.Handler$Abstract.doStop(Handler.java:403)
	at org.eclipse.jetty.server.Server.doStop(Server.java:648)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
	at com.github.mvysny.vaadinboot.VaadinBoot.stop(VaadinBoot.java:366)
	at com.github.mvysny.vaadinboot.VaadinBoot.lambda$run$0(VaadinBoot.java:246)
	at java.base/java.lang.Thread.run(Thread.java:833)

This only happens when the app is ran via the run script; this is not reproducible when main() is run from IDE.

Steps to reproduce:

  1. ./gradlew
  2. cd testapp/build/distributions/
  3. unzip testapp-12.0-SNAPSHOT.zip
  4. cd testapp/bin
  5. ./testapp
  6. When the app starts, press Enter to terminate the app
@mvysny mvysny self-assigned this Jul 21, 2023
@mvysny mvysny added the bug Something isn't working label Jul 21, 2023
@mvysny
Copy link
Owner Author

mvysny commented Jul 21, 2023

Changing VaadinBoot:330 to Env.findWebRoot(ResourceFactory.root()) fixes the issue, however this creates another issue: the resources are no longer GCed when Jetty stops, they persist until the JVM itself stops.

I'll open a ticket at Jetty to ask for guidelines.

@mvysny
Copy link
Owner Author

mvysny commented Jul 21, 2023

Filed upstream: jetty/jetty.project#10134

@mvysny mvysny added the blocked by upstream Something needs to be fixed in another library first label Jul 21, 2023
@mvysny
Copy link
Owner Author

mvysny commented Aug 8, 2023

Upgraded Jetty to 12.0.0, the issue can no longer be reproduced 🥳

Fixed by 0611478

@mvysny mvysny closed this as completed Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked by upstream Something needs to be fixed in another library first bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant