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

[Question] Custom command to restart my server doesn't seem to work #225

Closed
2 tasks done
eydrien-dev opened this issue Mar 21, 2024 · 14 comments
Closed
2 tasks done
Labels
cannot reproduce [NP] question Further information is requested

Comments

@eydrien-dev
Copy link

eydrien-dev commented Mar 21, 2024

Checks

Description

So i have a custom command created by this mod (https://modrinth.com/mod/restart-server). Basically restarts the servers; I have it edited so it works with screen on linux, so basically when I hit restart, server closes, delete the current screen and creates a new one with the new instance of the starting process working.

When I try to execute this command through "/console restart" on my discord channel using this mod, my minecraft character exits the game as if the game is closing as normal, but the game doesn't really close.

and it shows this error after doing so. (server is still up and I can join back, it just that it doesn't restart at all)
edit: https://mclo.gs/An6qAmo for better formatting.

[20:22:08] [JDA MainWS-ReadThread/INFO]: [Discord] EYDRIEN executed /console command: restart command!
[20:22:09] [ForkJoinPool.commonPool-worker-1/INFO]: [Restart Server] Restarting server...
[20:22:09] [Server thread/INFO]: _Eydrien_ lost connection: Restarting server...
[20:22:09] [Server thread/INFO]: [ADMIN] EYDRIEN left the game
[20:22:09] [Server thread/INFO]: remove player wand
[20:22:09] [Server thread/INFO]: Updating all forceload tickets for 2350489b-73b4-3a3e-8d9a-6ea18fe2527e
[20:22:09] [Server thread/INFO]: [voicechat] Disconnecting client [ADMIN] EYDRIEN
[20:22:09] [Server thread/WARN]: handleDisconnection() called twice
[20:22:09] [ForkJoinPool.commonPool-worker-1/ERROR]: Command exception: /restart
java.util.ConcurrentModificationException: null
        at java.util.ArrayList.forEach(ArrayList.java:1513) ~[?:?]
        at io.github.steveplays28.restartserver.commands.RestartCommand.execute(RestartCommand.java:28) ~[restart-server-1.2.0+mc1.19.x-1.20.x.jar:?]
        at io.github.steveplays28.restartserver.commands.RestartCommand.lambda$register$0(RestartCommand.java:20) ~[restart-server-1.2.0+mc1.19.x-1.20.x.jar:?]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[brigadier-1.1.8.jar:?]
        at net.minecraft.server.command.CommandManager.redirect$zmp000$architectury$performCommand(CommandManager.java:1545) ~[server-intermediary.jar:?]
        at net.minecraft.server.command.CommandManager.execute(CommandManager.java:287) ~[server-intermediary.jar:?]
        at com.xujiayao.discord_mc_chat.discord.DiscordEventListener.lambda$onSlashCommandInteraction$2(DiscordEventListener.java:153) ~[discord-mc-chat-1_20_1-2.3.2-3459ca43d8e140e1.jar:?]
        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863) ~[?:?]
        at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841) ~[?:?]
        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
        at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147) ~[?:?]
        at net.dv8tion.jda.internal.requests.restaction.TriggerRestAction.lambda$submit$4(TriggerRestAction.java:139) ~[net_dv8tion_jda-5.0.0-beta.18-7e0acf4837b6ce56.jar:?]
        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863) ~[?:?]
        at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841) ~[?:?]
        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
        at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147) ~[?:?]
        at net.dv8tion.jda.api.requests.Request.lambda$onSuccess$0(Request.java:121) ~[net_dv8tion_jda-5.0.0-beta.18-7e0acf4837b6ce56.jar:?]
        at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395) ~[?:?]
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
        at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
        at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]

If I do it normally just using the command /restart ingame it works perfectly, so I'm not really sure what could be the problem here. Any ideas or solutions?

@eydrien-dev eydrien-dev added the question Further information is requested label Mar 21, 2024
@eydrien-dev
Copy link
Author

Further testing I realized the problem only occurs when there's players online. When you do it with no one online it basically execute the command completely and the server restarts. So the problem have to be with users.

@Xujiayao
Copy link
Owner

It doesn't seem to be a problem with DMCC.

Even when the server is completely clean (only restart-server and its dependencies are installed), it still cannot restart normally and crashes.

[17:07:17] [Server thread/INFO]: Xujiayao[/127.0.0.1:2857] logged in with entity id 294 at (-13.0, 64.0, -340.0)
[17:07:17] [Server thread/INFO]: Xujiayao joined the game
restart
[17:07:23] [Server thread/INFO]: [Restart Server] Restarting server...
[17:07:23] [Server thread/ERROR]: Encountered an unexpected exception
java.lang.NoSuchMethodError: 'void net.minecraft.class_3244.method_14367(net.minecraft.class_2561)'
        at io.github.steveplays28.restartserver.commands.RestartCommand.lambda$execute$2(RestartCommand.java:28) ~[restart-server-1.2.0+mc1.19.x-1.20.x.jar:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at io.github.steveplays28.restartserver.commands.RestartCommand.execute(RestartCommand.java:28) ~[restart-server-1.2.0+mc1.19.x-1.20.x.jar:?]
        at io.github.steveplays28.restartserver.commands.RestartCommand.lambda$register$0(RestartCommand.java:20) ~[restart-server-1.2.0+mc1.19.x-1.20.x.jar:?]
        at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.2.9.jar:?]
        at net.minecraft.class_8865.method_54416(class_8865.java:29) ~[server-intermediary.jar:?]
        at net.minecraft.class_8865.execute(class_8865.java:13) ~[server-intermediary.jar:?]
        at net.minecraft.class_8856.method_54405(class_8856.java:8) ~[server-intermediary.jar:?]
        at net.minecraft.class_8847.method_54388(class_8847.java:8) ~[server-intermediary.jar:?]
        at net.minecraft.class_8854.method_54390(class_8854.java:107) ~[server-intermediary.jar:?]
        at net.minecraft.class_2170.method_54313(class_2170.java:378) ~[server-intermediary.jar:?]
        at net.minecraft.class_2170.method_9249(class_2170.java:308) ~[server-intermediary.jar:?]
        at net.minecraft.class_2170.method_44252(class_2170.java:298) ~[server-intermediary.jar:?]
        at net.minecraft.class_3176.method_13941(class_3176.java:299) ~[server-intermediary.jar:?]
        at net.minecraft.class_3176.method_3813(class_3176.java:284) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:845) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:683) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270) ~[server-intermediary.jar:?]
        at java.lang.Thread.run(Thread.java:842) ~[?:?]
[17:07:24] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Xujiayao\Desktop\Server\.\crash-reports\crash-2024-03-22_17.07.24-server.txt
[17:07:24] [Server thread/INFO]: Stopping server
[17:07:24] [Server thread/INFO]: Saving players
[17:07:24] [Server thread/INFO]: Xujiayao lost connection: Server closed
[17:07:24] [Server thread/INFO]: Xujiayao left the game
[17:07:24] [Server thread/INFO]: Saving worlds
[17:07:24] [Server thread/INFO]: Saving chunks for level 'ServerLevel[新的世界]'/minecraft:overworld
[17:07:24] [Server thread/INFO]: Saving chunks for level 'ServerLevel[新的世界]'/minecraft:the_nether
[17:07:24] [Server thread/INFO]: Saving chunks for level 'ServerLevel[新的世界]'/minecraft:the_end
[17:07:24] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
[17:07:24] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[17:07:24] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[17:07:24] [Server thread/INFO]: ThreadedAnvilChunkStorage: All dimensions are saved

@eydrien-dev
Copy link
Author

It works for me when doing it ingame or in the console, it just doesn't work when doing it through discord when players are online.

@Xujiayao
Copy link
Owner

What game version are you?

@eydrien-dev
Copy link
Author

fabric 1.20.1

@Xujiayao
Copy link
Owner

Lemme try that

@eydrien-dev
Copy link
Author

putty_PcBRW5Frzw

this is how I have my config to make it work through screen.

@Xujiayao
Copy link
Owner

Boom... That restart-server mod is incompatible with 1.20.4. (@Steveplays28)

And the restart function still works perfectly in 1.20.1 with player in the server
(Discord command: /console restart)
I am using completely default settings.

image

image

@eydrien-dev
Copy link
Author

eydrien-dev commented Mar 22, 2024

Then I don't know what could it be that is causing me to not work when players are online through discord console command. Could it be for having stuff messing with nicknames? Like my minecraft name is _Eydrien_, but I'm using StyledChat & StyledNicknames for formatting and also luckperms for prefixes.

@Xujiayao
Copy link
Owner

Could you send me your server zip for testing? The world folder is not needed. You may obscure the token if you feel it necessary.

You may send it via my email: i#xujiayao.com

@Steveplays28
Copy link

Thanks for the heads up. Had no clue it was incompatible with 1.20.4.
I'll investigate. In the meantime, I can recommend alternatives such as hosting with Docker + Portainer, setting an auto-restart mode, and simply running /stop (as I mentioned to eydrien in my Discord server as well).

@Xujiayao
Copy link
Owner

Oops, sorry. I didn't know you two had been in touch 😂

@Steveplays28
Copy link

All good!

@Xujiayao Xujiayao changed the title [Question] Custom command to restart my server doesn't seem to work. [Question] Custom command to restart my server doesn't seem to work Jul 3, 2024
@Xujiayao
Copy link
Owner

Xujiayao commented Jul 3, 2024

Closing due to not being able to reproduce.

@Xujiayao Xujiayao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cannot reproduce [NP] question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants