dzikoysk / reposilite

Lightweight and easy-to-use repository management software dedicated for the Maven-based artifacts in the JVM ecosystem 📦
https://reposilite.com
Apache License 2.0
1.41k stars 190 forks source link

FileSystemStorageProvider throws FileAlreadyExistsException during concurrent put operation #2027

Closed mkrueger92 closed 10 months ago

mkrueger92 commented 10 months ago

What happened?

While using reposilite and opening a new gradle project (building for the first time with lots of dependencies and modules) reposilite terminated suddenly.

It seems that concurrent access to a non existent resource (not cached but then fetched from the mirrored repo) leads to some sort of race condition. Also, I assume that the current behavior leads to multiple parallel downloads of the same file from the mirrored repository.

See the log output for more information.

Reposilite version

3.x

Relevant log output

13:05:50.038 ERROR | java.nio.file.FileAlreadyExistsException: /app/data/repositories/my-mirror-repo/com/.../....pom
13:05:50.038 ERROR |    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
13:05:50.039 ERROR |    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
13:05:50.039 ERROR |    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
13:05:50.039 ERROR |    at java.base/sun.nio.fs.UnixFileSystem.copyFile(UnixFileSystem.java:668)
13:05:50.039 ERROR |    at java.base/sun.nio.fs.UnixFileSystem.move(UnixFileSystem.java:949)
13:05:50.039 ERROR |    at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:309)
13:05:50.039 ERROR |    at java.base/java.nio.file.Files.move(Files.java:1430)
13:05:50.039 ERROR |    at com.reposilite.storage.filesystem.FileSystemStorageProvider.putFile$lambda$4$lambda$3(FileSystemStorageProvider.kt:87)
13:05:50.039 ERROR |    at panda.std.Result.map(Result.java:152)
13:05:50.040 ERROR |    at com.reposilite.storage.filesystem.FileSystemStorageProvider.putFile(FileSystemStorageProvider.kt:69)
13:05:50.040 ERROR |    at com.reposilite.maven.MirrorService.storeFile(MirrorService.kt:69)
13:05:50.040 ERROR |    at com.reposilite.maven.MirrorService.access$storeFile(MirrorService.kt:37)
13:05:50.040 ERROR |    at com.reposilite.maven.MirrorService$findRemoteFile$1.invoke$lambda$0(MirrorService.kt:63)
13:05:50.040 ERROR |    at panda.std.Result.flatMap(Result.java:170)
13:05:50.040 ERROR |    at com.reposilite.maven.MirrorService$findRemoteFile$1.invoke(MirrorService.kt:63)
13:05:50.040 ERROR |    at com.reposilite.maven.MirrorService$findRemoteFile$1.invoke(MirrorService.kt:61)
13:05:50.040 ERROR |    at com.reposilite.maven.MirrorService$searchInRemoteRepositories$2.invoke(MirrorService.kt:83)
13:05:50.041 ERROR |    at com.reposilite.maven.MirrorService$searchInRemoteRepositories$2.invoke(MirrorService.kt:83)
13:05:50.041 ERROR |    at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
13:05:50.041 ERROR |    at com.reposilite.maven.MirrorService.searchInRemoteRepositories(MirrorService.kt:114)
13:05:50.041 ERROR |    at com.reposilite.maven.MirrorService.findRemoteFile(MirrorService.kt:61)
13:05:50.041 ERROR |    at com.reposilite.maven.RepositoryService.findInputStream(RepositoryService.kt:161)
13:05:50.041 ERROR |    at com.reposilite.maven.RepositoryService.findFile$lambda$14(RepositoryService.kt:144)
13:05:50.041 ERROR |    at panda.std.Result.flatMap(Result.java:170)
13:05:50.041 ERROR |    at com.reposilite.maven.RepositoryService.findFile(RepositoryService.kt:144)
13:05:50.042 ERROR |    at com.reposilite.maven.RepositoryService.access$findFile(RepositoryService.kt:50)
13:05:50.042 ERROR |    at com.reposilite.maven.RepositoryService$findFile$1.invoke(RepositoryService.kt:117)
13:05:50.042 ERROR |    at com.reposilite.maven.RepositoryService$findFile$1.invoke(RepositoryService.kt:116)
13:05:50.042 ERROR |    at com.reposilite.maven.RepositoryService.resolve$lambda$10(RepositoryService.kt:134)
13:05:50.042 ERROR |    at panda.std.Result.flatMap(Result.java:170)
13:05:50.042 ERROR |    at com.reposilite.maven.RepositoryService.resolve(RepositoryService.kt:134)
13:05:50.043 ERROR |    at com.reposilite.maven.RepositoryService.findFile(RepositoryService.kt:116)
13:05:50.043 ERROR |    at com.reposilite.maven.MavenFacade.findFile(MavenFacade.kt:55)
13:05:50.043 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1$1.invoke(MavenEndpoints.kt:65)
13:05:50.043 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1$1.invoke(MavenEndpoints.kt:63)
13:05:50.043 ERROR |    at com.reposilite.maven.infrastructure.MavenRoutes.requireGav(MavenRoutes.kt:48)
13:05:50.043 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1.invoke(MavenEndpoints.kt:63)
13:05:50.043 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1.invoke(MavenEndpoints.kt:62)
13:05:50.044 ERROR |    at com.reposilite.shared.ContextDsl.accessed(ContextDsl.kt:60)
13:05:50.044 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1.invoke(MavenEndpoints.kt:62)
13:05:50.044 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1.invoke(MavenEndpoints.kt:61)
13:05:50.044 ERROR |    at com.reposilite.web.application.JavalinConfiguration$configureRoutingPlugin$reposiliteDsl$1.invoke$lambda$0(JavalinConfiguration.kt:162)
13:05:50.044 ERROR |    at io.javalin.routing.HandlerEntry.handle(HandlerEntry.kt:19)
13:05:50.044 ERROR |    at io.javalin.http.servlet.DefaultTasks.HTTP$lambda$8$lambda$6$lambda$5(DefaultTasks.kt:39)
13:05:50.044 ERROR |    at io.javalin.http.servlet.JavalinServlet.handleTask(JavalinServlet.kt:88)
13:05:50.044 ERROR |    at io.javalin.http.servlet.JavalinServlet.handleSync(JavalinServlet.kt:53)
13:05:50.044 ERROR |    at io.javalin.http.servlet.JavalinServlet.service(JavalinServlet.kt:41)
13:05:50.045 ERROR |    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
13:05:50.048 ERROR |    at io.javalin.jetty.JavalinJettyServlet.service(JavalinJettyServlet.kt:58)
13:05:50.048 ERROR |    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
13:05:50.048 ERROR |    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
13:05:50.049 ERROR |    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:529)
13:05:50.049 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
13:05:50.049 ERROR |    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
13:05:50.049 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
13:05:50.049 ERROR |    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
13:05:50.049 ERROR |    at io.javalin.jetty.JettyServer$start$wsAndHttpHandler$1.doHandle(JettyServer.kt:61)
13:05:50.049 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
13:05:50.049 ERROR |    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
13:05:50.049 ERROR |    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
13:05:50.050 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
13:05:50.050 ERROR |    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
13:05:50.050 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
13:05:50.050 ERROR |    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
13:05:50.050 ERROR |    at org.eclipse.jetty.server.Server.handle(Server.java:563)
13:05:50.050 ERROR |    at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
13:05:50.050 ERROR |    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
13:05:50.050 ERROR |    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
13:05:50.050 ERROR |    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
13:05:50.051 ERROR |    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
13:05:50.051 ERROR |    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
13:05:50.051 ERROR |    at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
13:05:50.051 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
13:05:50.051 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
13:05:50.051 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
13:05:50.051 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
13:05:50.051 ERROR |    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
13:05:50.051 ERROR |    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
13:05:50.052 ERROR |    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
13:05:50.052 ERROR |    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
13:05:50.052 ERROR |    at java.base/java.lang.Thread.run(Thread.java:1583)
mkrueger92 commented 10 months ago

I will have a look at the code when I have time and maybe provide a PR. But that may take some time.

dzikoysk commented 10 months ago

I've lately introduced some changes to the related codebase, so there's a possibility that something like that may happen. I don't think it should terminate the instance tho - what's the exit code for the app? 🤔

As a quick fix, we should add FileAlreadyExistsException here:

Eventually, we should just implement some sort of a queue for mirrored artifacts to get rid of such situations. We already have IO executor service, so we could reuse that for this particular use case.

ivy-cst commented 9 months ago

I still get the FileAlreadyExistsException even with Reposilite 3.5.5. I do not understand why this can happen as you catched this exception, I think it is a kotlin problem. May you catched the kotiln FileAlreadyExistsException: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/-file-already-exists-exception/ instead of the java nio one java.nio.file.FileAlreadyExistsException

There is also a NoSuchFileException on the reading part, see second stacktrace. May be because another thread did replace the file in the meanwile? Because you use Files.move(temporaryFile.toPath(), file, REPLACE_EXISTING).

By the way it seems there is also a kotlin variant of the NoSuchFileException. But looks like you have a correct import for that in the FileSystemStorageProvider.

May be it is better to first check if the destination File exists and if the content is equal? You could use Files.mismatch(), if it returns -1 the files are equal. And in case of a FileAlreadyExistsException again make the content equal check and only replace the file if the content is not equal.

15:27:49.127 INFO | Reposilite 3.5.5 Status
15:27:49.128 INFO |   Active: true
15:27:49.128 INFO |   Uptime: 1s
15:27:49.129 INFO |   Memory usage of process: 19.96M
15:27:49.129 INFO |   Active threads in group: 38
15:27:49.129 INFO |   Recorded failures: 0
15:27:49.129 INFO |   Latest version of Reposilite: 3.5.5
15:27:49.130 INFO | 
15:27:49.130 INFO | For help, type 'help' or '?'
15:32:21.172 ERROR | /central/org/apache/apache/21/apache-21.pom
15:32:21.177 ERROR | java.nio.file.FileAlreadyExistsException: /app/data/repositories/central/org/apache/apache/21/apache-21.pom
15:32:21.179 ERROR |    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
15:32:21.179 ERROR |    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
15:32:21.180 ERROR |    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
15:32:21.180 ERROR |    at java.base/sun.nio.fs.UnixFileSystem.copyFile(UnixFileSystem.java:668)
15:32:21.181 ERROR |    at java.base/sun.nio.fs.UnixFileSystem.move(UnixFileSystem.java:949)
15:32:21.181 ERROR |    at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:309)
15:32:21.182 ERROR |    at java.base/java.nio.file.Files.move(Files.java:1430)
15:32:21.182 ERROR |    at com.reposilite.storage.filesystem.FileSystemStorageProvider.putFile$lambda$4$lambda$3(FileSystemStorageProvider.kt:87)
15:32:21.182 ERROR |    at panda.std.Result.map(Result.java:152)
15:32:21.183 ERROR |    at com.reposilite.storage.filesystem.FileSystemStorageProvider.putFile(FileSystemStorageProvider.kt:69)
15:32:21.183 ERROR |    at com.reposilite.maven.MirrorService.storeFile(MirrorService.kt:69)
15:32:21.184 ERROR |    at com.reposilite.maven.MirrorService.access$storeFile(MirrorService.kt:37)
15:32:21.184 ERROR |    at com.reposilite.maven.MirrorService$findRemoteFile$1.invoke$lambda$0(MirrorService.kt:63)
15:32:21.184 ERROR |    at panda.std.Result.flatMap(Result.java:170)
15:32:21.184 ERROR |    at com.reposilite.maven.MirrorService$findRemoteFile$1.invoke(MirrorService.kt:63)
15:32:21.185 ERROR |    at com.reposilite.maven.MirrorService$findRemoteFile$1.invoke(MirrorService.kt:61)
15:32:21.185 ERROR |    at com.reposilite.maven.MirrorService$searchInRemoteRepositories$2.invoke(MirrorService.kt:83)
15:32:21.186 ERROR |    at com.reposilite.maven.MirrorService$searchInRemoteRepositories$2.invoke(MirrorService.kt:83)
15:32:21.186 ERROR |    at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
15:32:21.186 ERROR |    at com.reposilite.maven.MirrorService.searchInRemoteRepositories(MirrorService.kt:114)
15:32:21.186 ERROR |    at com.reposilite.maven.MirrorService.findRemoteFile(MirrorService.kt:61)
15:32:21.187 ERROR |    at com.reposilite.maven.RepositoryService.findInputStream(RepositoryService.kt:161)
15:32:21.187 ERROR |    at com.reposilite.maven.RepositoryService.findFile$lambda$14(RepositoryService.kt:144)
15:32:21.187 ERROR |    at panda.std.Result.flatMap(Result.java:170)
15:32:21.188 ERROR |    at com.reposilite.maven.RepositoryService.findFile(RepositoryService.kt:144)
15:32:21.188 ERROR |    at com.reposilite.maven.RepositoryService.access$findFile(RepositoryService.kt:50)
15:32:21.189 ERROR |    at com.reposilite.maven.RepositoryService$findFile$1.invoke(RepositoryService.kt:117)
15:32:21.189 ERROR |    at com.reposilite.maven.RepositoryService$findFile$1.invoke(RepositoryService.kt:116)
15:32:21.189 ERROR |    at com.reposilite.maven.RepositoryService.resolve$lambda$10(RepositoryService.kt:134)
15:32:21.190 ERROR |    at panda.std.Result.flatMap(Result.java:170)
15:32:21.190 ERROR |    at com.reposilite.maven.RepositoryService.resolve(RepositoryService.kt:134)
15:32:21.190 ERROR |    at com.reposilite.maven.RepositoryService.findFile(RepositoryService.kt:116)
15:32:21.190 ERROR |    at com.reposilite.maven.MavenFacade.findFile(MavenFacade.kt:55)
15:32:21.191 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1$1.invoke(MavenEndpoints.kt:65)
15:32:21.191 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1$1.invoke(MavenEndpoints.kt:63)
15:32:21.191 ERROR |    at com.reposilite.maven.infrastructure.MavenRoutes.requireGav(MavenRoutes.kt:48)
15:32:21.192 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1.invoke(MavenEndpoints.kt:63)
15:32:21.192 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1.invoke(MavenEndpoints.kt:62)
15:32:21.193 ERROR |    at com.reposilite.shared.ContextDsl.accessed(ContextDsl.kt:60)
15:32:21.193 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1.invoke(MavenEndpoints.kt:62)
15:32:21.193 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1.invoke(MavenEndpoints.kt:61)
15:32:21.194 ERROR |    at com.reposilite.web.infrastructure.ReposiliteRoutingKt$createReposiliteDsl$dsl$1.invoke$lambda$0(ReposiliteRouting.kt:78)
15:32:21.194 ERROR |    at io.javalin.router.Endpoint.handle(Endpoint.kt:29)
15:32:21.194 ERROR |    at io.javalin.router.ParsedEndpoint.handle(ParsedEndpoint.kt:15)
15:32:21.195 ERROR |    at io.javalin.http.servlet.DefaultTasks.HTTP$lambda$8$lambda$6$lambda$5(DefaultTasks.kt:41)
15:32:21.195 ERROR |    at io.javalin.http.servlet.JavalinServlet.handleTask(JavalinServlet.kt:99)
15:32:21.195 ERROR |    at io.javalin.http.servlet.JavalinServlet.handleSync(JavalinServlet.kt:64)
15:32:21.196 ERROR |    at io.javalin.http.servlet.JavalinServlet.handle(JavalinServlet.kt:50)
15:32:21.196 ERROR |    at io.javalin.http.servlet.JavalinServlet.service(JavalinServlet.kt:30)
15:32:21.196 ERROR |    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
15:32:21.197 ERROR |    at io.javalin.jetty.JavalinJettyServlet.service(JavalinJettyServlet.kt:52)
15:32:21.197 ERROR |    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
15:32:21.198 ERROR |    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
15:32:21.198 ERROR |    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:529)
15:32:21.198 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
15:32:21.199 ERROR |    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)
15:32:21.199 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
15:32:21.199 ERROR |    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
15:32:21.200 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
15:32:21.200 ERROR |    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
15:32:21.200 ERROR |    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
15:32:21.201 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
15:32:21.201 ERROR |    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
15:32:21.202 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
15:32:21.202 ERROR |    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
15:32:21.202 ERROR |    at org.eclipse.jetty.server.Server.handle(Server.java:563)
15:32:21.203 ERROR |    at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
15:32:21.203 ERROR |    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
15:32:21.204 ERROR |    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
15:32:21.204 ERROR |    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
15:32:21.204 ERROR |    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
15:32:21.205 ERROR |    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
15:32:21.205 ERROR |    at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
15:32:21.206 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
15:32:21.206 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
15:32:21.207 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
15:32:21.207 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
15:32:21.208 ERROR |    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
15:32:21.208 ERROR |    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
15:32:21.208 ERROR |    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
15:32:21.209 ERROR |    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
15:32:21.209 ERROR |    at java.base/java.lang.Thread.run(Thread.java:1583)
15:32:21.210 ERROR | 
15:32:22.357 ERROR | /central/org/eclipse/jdt/org.eclipse.jdt.core/3.35.0/org.eclipse.jdt.core-3.35.0.pom.sha1
15:32:22.358 ERROR | java.nio.file.NoSuchFileException: /app/data/repositories/central/org/eclipse/jdt/org.eclipse.jdt.core/3.35.0/org.eclipse.jdt.core-3.35.0.pom.sha1
15:32:22.360 ERROR |    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
15:32:22.360 ERROR |    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
15:32:22.360 ERROR |    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
15:32:22.361 ERROR |    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:261)
15:32:22.361 ERROR |    at java.base/java.nio.file.Files.newByteChannel(Files.java:379)
15:32:22.362 ERROR |    at java.base/java.nio.file.Files.newByteChannel(Files.java:431)
15:32:22.362 ERROR |    at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
15:32:22.362 ERROR |    at java.base/java.nio.file.Files.newInputStream(Files.java:159)
15:32:22.363 ERROR |    at com.reposilite.storage.PathsKt.inputStream$lambda$2(Paths.kt:38)
15:32:22.363 ERROR |    at panda.std.Result.map(Result.java:152)
15:32:22.363 ERROR |    at com.reposilite.storage.PathsKt.inputStream(Paths.kt:38)
15:32:22.364 ERROR |    at com.reposilite.storage.filesystem.FileSystemStorageProvider.getFile$lambda$5(FileSystemStorageProvider.kt:105)
15:32:22.364 ERROR |    at panda.std.Result.flatMap(Result.java:170)
15:32:22.365 ERROR |    at com.reposilite.storage.filesystem.FileSystemStorageProvider.getFile(FileSystemStorageProvider.kt:105)
15:32:22.365 ERROR |    at com.reposilite.maven.MirrorService.storeFile$lambda$2(MirrorService.kt:70)
15:32:22.365 ERROR |    at panda.std.Result.flatMap(Result.java:170)
15:32:22.366 ERROR |    at com.reposilite.maven.MirrorService.storeFile(MirrorService.kt:70)
15:32:22.366 ERROR |    at com.reposilite.maven.MirrorService.access$storeFile(MirrorService.kt:37)
15:32:22.366 ERROR |    at com.reposilite.maven.MirrorService$findRemoteFile$1.invoke$lambda$0(MirrorService.kt:63)
15:32:22.366 ERROR |    at panda.std.Result.flatMap(Result.java:170)
15:32:22.367 ERROR |    at com.reposilite.maven.MirrorService$findRemoteFile$1.invoke(MirrorService.kt:63)
15:32:22.367 ERROR |    at com.reposilite.maven.MirrorService$findRemoteFile$1.invoke(MirrorService.kt:61)
15:32:22.367 ERROR |    at com.reposilite.maven.MirrorService$searchInRemoteRepositories$2.invoke(MirrorService.kt:83)
15:32:22.367 ERROR |    at com.reposilite.maven.MirrorService$searchInRemoteRepositories$2.invoke(MirrorService.kt:83)
15:32:22.368 ERROR |    at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
15:32:22.368 ERROR |    at com.reposilite.maven.MirrorService.searchInRemoteRepositories(MirrorService.kt:114)
15:32:22.368 ERROR |    at com.reposilite.maven.MirrorService.findRemoteFile(MirrorService.kt:61)
15:32:22.368 ERROR |    at com.reposilite.maven.RepositoryService.findInputStream(RepositoryService.kt:161)
15:32:22.369 ERROR |    at com.reposilite.maven.RepositoryService.findFile$lambda$14(RepositoryService.kt:144)
15:32:22.369 ERROR |    at panda.std.Result.flatMap(Result.java:170)
15:32:22.369 ERROR |    at com.reposilite.maven.RepositoryService.findFile(RepositoryService.kt:144)
15:32:22.370 ERROR |    at com.reposilite.maven.RepositoryService.access$findFile(RepositoryService.kt:50)
15:32:22.370 ERROR |    at com.reposilite.maven.RepositoryService$findFile$1.invoke(RepositoryService.kt:117)
15:32:22.370 ERROR |    at com.reposilite.maven.RepositoryService$findFile$1.invoke(RepositoryService.kt:116)
15:32:22.371 ERROR |    at com.reposilite.maven.RepositoryService.resolve$lambda$10(RepositoryService.kt:134)
15:32:22.371 ERROR |    at panda.std.Result.flatMap(Result.java:170)
15:32:22.371 ERROR |    at com.reposilite.maven.RepositoryService.resolve(RepositoryService.kt:134)
15:32:22.372 ERROR |    at com.reposilite.maven.RepositoryService.findFile(RepositoryService.kt:116)
15:32:22.372 ERROR |    at com.reposilite.maven.MavenFacade.findFile(MavenFacade.kt:55)
15:32:22.372 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1$1.invoke(MavenEndpoints.kt:65)
15:32:22.372 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1$1.invoke(MavenEndpoints.kt:63)
15:32:22.373 ERROR |    at com.reposilite.maven.infrastructure.MavenRoutes.requireGav(MavenRoutes.kt:48)
15:32:22.373 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1.invoke(MavenEndpoints.kt:63)
15:32:22.373 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1$1.invoke(MavenEndpoints.kt:62)
15:32:22.373 ERROR |    at com.reposilite.shared.ContextDsl.accessed(ContextDsl.kt:60)
15:32:22.374 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1.invoke(MavenEndpoints.kt:62)
15:32:22.374 ERROR |    at com.reposilite.maven.infrastructure.MavenEndpoints$findFile$1.invoke(MavenEndpoints.kt:61)
15:32:22.374 ERROR |    at com.reposilite.web.infrastructure.ReposiliteRoutingKt$createReposiliteDsl$dsl$1.invoke$lambda$0(ReposiliteRouting.kt:78)
15:32:22.374 ERROR |    at io.javalin.router.Endpoint.handle(Endpoint.kt:29)
15:32:22.375 ERROR |    at io.javalin.router.ParsedEndpoint.handle(ParsedEndpoint.kt:15)
15:32:22.375 ERROR |    at io.javalin.http.servlet.DefaultTasks.HTTP$lambda$8$lambda$6$lambda$5(DefaultTasks.kt:41)
15:32:22.375 ERROR |    at io.javalin.http.servlet.JavalinServlet.handleTask(JavalinServlet.kt:99)
15:32:22.375 ERROR |    at io.javalin.http.servlet.JavalinServlet.handleSync(JavalinServlet.kt:64)
15:32:22.375 ERROR |    at io.javalin.http.servlet.JavalinServlet.handle(JavalinServlet.kt:50)
15:32:22.376 ERROR |    at io.javalin.http.servlet.JavalinServlet.service(JavalinServlet.kt:30)
15:32:22.376 ERROR |    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
15:32:22.376 ERROR |    at io.javalin.jetty.JavalinJettyServlet.service(JavalinJettyServlet.kt:52)
15:32:22.376 ERROR |    at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
15:32:22.377 ERROR |    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
15:32:22.377 ERROR |    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:529)
15:32:22.377 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
15:32:22.378 ERROR |    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)
15:32:22.378 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
15:32:22.378 ERROR |    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
15:32:22.378 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
15:32:22.378 ERROR |    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
15:32:22.379 ERROR |    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
15:32:22.379 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
15:32:22.379 ERROR |    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
15:32:22.379 ERROR |    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
15:32:22.380 ERROR |    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
15:32:22.380 ERROR |    at org.eclipse.jetty.server.Server.handle(Server.java:563)
15:32:22.380 ERROR |    at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
15:32:22.380 ERROR |    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
15:32:22.381 ERROR |    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
15:32:22.381 ERROR |    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
15:32:22.381 ERROR |    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
15:32:22.382 ERROR |    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
15:32:22.382 ERROR |    at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
15:32:22.383 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
15:32:22.383 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
15:32:22.383 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
15:32:22.384 ERROR |    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
15:32:22.384 ERROR |    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
15:32:22.385 ERROR |    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
15:32:22.385 ERROR |    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
15:32:22.385 ERROR |    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
15:32:22.386 ERROR |    at java.base/java.lang.Thread.run(Thread.java:1583)
dzikoysk commented 9 months ago

Nice catch man, indeed, we're catching a wrong exception. Without a dedicated import, it imports the one you've mentioned:

package kotlin.io

open public class FileSystemException(
    public val file: File,
    public val other: File? = null,
    public val reason: String? = null
) : IOException(constructMessage(file, other, reason))

/**
 * An exception class which is used when some file to create or copy to already exists.
 */
public class FileAlreadyExistsException(
    file: File,
    other: File? = null,
    reason: String? = null
) : FileSystemException(file, other, reason)

I didn't even know it exists. Let's convert this into an issue and continue there.