Skip to content

Answer an rcon command after the tasks it queued have run - #518

Closed
lewisgibson wants to merge 5 commits into
PaperMC:ver/26.2.xfrom
lewisgibson:rcon-reply-queued-tasks
Closed

lewisgibson wants to merge 5 commits into
PaperMC:ver/26.2.xfrom
lewisgibson:rcon-reply-queued-tasks

Conversation

@lewisgibson

@lewisgibson lewisgibson commented Oct 1, 2026 •

Copy link
Copy Markdown

Many commands that Folia dispatches to a region, the global region or an entity scheduler (time, xp query, enchant, place, weather, setblock, fill, forceload, worldborder and more) send their feedback from the task they queue, after the command itself has returned. The rcon connection was answered as soon as the command returned, so the reply was empty.

While an rcon command runs, the tasks it queues through RegionizedServer#addTask, RegionizedTaskQueue#queueTickTaskQueue, EntityScheduler#schedule (run or retired) and ServerLevel#moonrise$loadChunksAsync are tracked, and the rcon thread waits for them before it reads the response. Only the tasks the command itself queued are waited for, not the ones those tasks queue in turn, and the wait is capped at 20 seconds and happens on the rcon thread. The change is in the existing Region Threading Base patches (minecraft and paper), no new patch. It does not depend on #517.

Tested on ver/26.2.x with 53 commands sent over rcon in a row, on an unpatched build and then on this one:

  • Before: 14 empty replies (time set, time add, xp query, enchant, place feature, weather, setblock, fill twice, forceload add, query and remove, worldborder get and say).
  • After: only say hi is empty, and it only broadcasts to the players. time set 6000 answers Set minecraft:overworld to 6000 tick(s), xp query answers Rc has 3 experience points and forceload add 0 0 answers Marked chunk [0, 0] in minecraft:overworld to be force loaded, each within 0.1 seconds, with no errors in the log.

This was done with AI (Claude Opus 5.5 and GPT Astra, high effort). I've reviewed it and tested it myself.

Folia does not register /save-all, so backup scripts bracketing a copy with save-off, save-all flush and save-on get Unknown command. See the patch for details.
Commands that Folia hands to a region, the global region or an entity scheduler reply after the command returned, so their rcon response was empty. Builds on the save-all change, which adds the pending completion mechanism. See the patches for details.
@lewisgibson
lewisgibson marked this pull request as ready for review October 1, 2026 21:45
@lewisgibson lewisgibson closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant