iohao / ioGame

无锁异步化、事件驱动架构设计的 java netty 网络编程框架; 轻量级,无需依赖任何第三方中间件或数据库就能支持集群、分布式; 适用于网络游戏服务器、物联网、内部系统及各种需要长连接的场景; 通过 ioGame 你可以很容易的搭建出一个集群无中心节点、集群自动化、分布式的网络服务器;FXGL、Unity、UE、Cocos Creator、Godot、Netty、Protobuf、webSocket、tcp、socket;java Netty 游戏服务器框架;
http://game.iohao.com
GNU Affero General Public License v3.0
904 stars 201 forks source link

服务器启动时扫描包异常 #175

Closed flyshulk closed 1 year ago

flyshulk commented 1 year ago
 Exception in thread "InternalRunOne1" Exception in thread "InternalRunOne2" java.lang.IllegalStateException: zip file closed
 at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:831)
 at java.base/java.util.zip.ZipFile$ZipEntryIterator.next(ZipFile.java:503)
 at java.base/java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:496)
 at java.base/java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:474)
 at com.iohao.game.common.kit.ClassScanner.scanJar(ClassScanner.java:129)
 at com.iohao.game.common.kit.ClassScanner.lambda$listScan$0(ClassScanner.java:81)
 at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
 at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
 at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
 at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
 at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754)
 at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
 at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:686)
 at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159)
 at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173)
 at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
 at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
 at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:765)
 at com.iohao.game.common.kit.ClassScanner.listScan(ClassScanner.java:77)
 at com.iohao.game.action.skeleton.core.BarSkeletonBuilderParamConfig.scanClass(BarSkeletonBuilderParamConfig.java:222)
 at com.iohao.game.action.skeleton.core.BarSkeletonBuilderParamConfig.scanClassActionController(BarSkeletonBuilderParamConfig.java:201)
 at com.iohao.game.action.skeleton.core.BarSkeletonBuilderParamConfig.createBuilder(BarSkeletonBuilderParamConfig.java:89)
 at com.test.LoginLogicStartup.createBarSkeleton(LoginLogicStartup.java:24)
 at com.iohao.game.bolt.broker.client.AbstractBrokerClientStartup.initConfig(AbstractBrokerClientStartup.java:106)
 at com.iohao.game.bolt.broker.client.BrokerClientApplication.start(BrokerClientApplication.java:47)
 at com.iohao.game.external.core.netty.simple.InternalRunOne.lambda$startupLogic$0(InternalRunOne.java:67)
 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
 at java.base/java.lang.Thread.run(Thread.java:833)
 java.lang.IllegalStateException: zip file closed
 at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:831)
 at java.base/java.util.zip.ZipFile$ZipEntryIterator.next(ZipFile.java:503)
 at java.base/java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:496)
 at java.base/java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:474)
 at com.iohao.game.common.kit.ClassScanner.scanJar(ClassScanner.java:129)
 at com.iohao.game.common.kit.ClassScanner.lambda$listScan$0(ClassScanner.java:81)
 at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
 at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
 at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
 at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
 at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754)
 at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
 at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:686)
 at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159)
 at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173)
 at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
 at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
 at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:765)
 at com.iohao.game.common.kit.ClassScanner.listScan(ClassScanner.java:77)
 at com.iohao.game.action.skeleton.core.BarSkeletonBuilderParamConfig.scanClass(BarSkeletonBuilderParamConfig.java:222)
 at com.iohao.game.action.skeleton.core.BarSkeletonBuilderParamConfig.scanClassActionController(BarSkeletonBuilderParamConfig.java:201)
 at com.iohao.game.action.skeleton.core.BarSkeletonBuilderParamConfig.createBuilder(BarSkeletonBuilderParamConfig.java:89)
 at com.test.PlayerLogicStartup.createBarSkeleton(PlayerLogicStartup.java:27)
 at com.iohao.game.bolt.broker.client.AbstractBrokerClientStartup.initConfig(AbstractBrokerClientStartup.java:106)
 at com.iohao.game.bolt.broker.client.BrokerClientApplication.start(BrokerClientApplication.java:47)
 at com.iohao.game.external.core.netty.simple.InternalRunOne.lambda$startupLogic$0(InternalRunOne.java:67)
 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
 at java.base/java.lang.Thread.run(Thread.java:833)

在IDEA下测试正常启动使用,在docker环境下启动就莫名报错

iohao commented 1 year ago

可以提供一个可复现的 demo 与复现步骤吗

flyshulk commented 1 year ago

工程比较复杂 没法复现步骤

iohao commented 1 year ago

工程比较复杂 没法复现步骤

先多打日志跟踪吧

flyshulk commented 1 year ago

把代码放在linux下面就会报错,在windows下正常

iohao commented 1 year ago

建议 debug

flyshulk commented 1 year ago

List logicServerList = List.of(loginLogicStartup, playerLogicStartup, battleLogicStartup);

    new NettyRunOne()
            .setExternalServer(externalServer)
            .setBrokerServer(brokerServer)
            .setLogicServerList(logicServerList)
            .startup();这样的方式,把三个逻辑服是三个工程 都打包到一个启动包,启动服务后会报上面的错
flyshulk commented 1 year ago

请问怎么避免java.lang.IllegalStateException: zip file closed的报错