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

bug: an concurrent error when there are a lot of entities #147

Open
smartcmd opened this issue Feb 11, 2024 · 1 comment
Open

bug: an concurrent error when there are a lot of entities #147

smartcmd opened this issue Feb 11, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@smartcmd
Copy link
Member

java.util.concurrent.CompletionException: java.util.concurrent.CompletionException: java.lang.IllegalStateException: Trying to set a chunk (-276,-94) which is already loaded
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:540) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:567) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:670) ~[?:?]
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:160) ~[?:?]
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:174) ~[?:?]
	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 org.allaymc.server.world.service.AllayEntityPhysicsService.tick(AllayEntityPhysicsService.java:70) ~[classes/:?]
	at org.allaymc.server.world.AllayDimension.tick(AllayDimension.java:59) ~[classes/:?]
	at org.allaymc.server.world.AllayWorld.lambda$tick$2(AllayWorld.java:151) ~[classes/:?]
	at it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap$1.forEach(Int2ObjectOpenHashMap.java:1214) ~[fastutil-8.5.13.jar:?]
	at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1116) ~[?:?]
	at org.allaymc.server.world.AllayWorld.tick(AllayWorld.java:151) ~[classes/:?]
	at org.allaymc.server.world.AllayWorld.lambda$new$0(AllayWorld.java:68) ~[classes/:?]
	at org.allaymc.api.utils.GameLoop.startLoop(GameLoop.java:70) ~[classes/:?]
	at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
Caused by: java.util.concurrent.CompletionException: java.lang.IllegalStateException: Trying to set a chunk (-276,-94) which is already loaded
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:649) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:653) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	... 1 more
Caused by: java.lang.IllegalStateException: Trying to set a chunk (-276,-94) which is already loaded
	at org.allaymc.server.world.service.AllayChunkService.setChunk(AllayChunkService.java:113) ~[classes/:?]
	at org.allaymc.server.world.service.AllayChunkService.lambda$loadChunk$6(AllayChunkService.java:182) ~[classes/:?]
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:653) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	... 1 more
@smartcmd smartcmd added the Bug Something isn't working label Feb 11, 2024
smartcmd added a commit that referenced this issue Feb 24, 2024
IWareQ added a commit that referenced this issue Feb 26, 2024
@IWareQ
Copy link
Member

IWareQ commented Feb 27, 2024

Fixed in this commit but using synchronized is not very good, we need to think about the best solution

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

No branches or pull requests

2 participants