diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index ed2987473..99e0fb552 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -46,7 +46,7 @@ jobs: run: echo ::set-output name=NAME::$(echo "${GITHUB_REPOSITORY,,}") - name: Build image for tag - uses: docker/build-push-action@v3.2.0 + uses: docker/build-push-action@v3.3.0 with: push: true context: ./pocketmine-mp @@ -59,7 +59,7 @@ jobs: - name: Build image for major tag if: steps.channel.outputs.CHANNEL == 'stable' - uses: docker/build-push-action@v3.2.0 + uses: docker/build-push-action@v3.3.0 with: push: true context: ./pocketmine-mp @@ -72,7 +72,7 @@ jobs: - name: Build image for minor tag if: steps.channel.outputs.CHANNEL == 'stable' - uses: docker/build-push-action@v3.2.0 + uses: docker/build-push-action@v3.3.0 with: push: true context: ./pocketmine-mp @@ -85,7 +85,7 @@ jobs: - name: Build image for latest tag if: steps.channel.outputs.CHANNEL == 'stable' - uses: docker/build-push-action@v3.2.0 + uses: docker/build-push-action@v3.3.0 with: push: true context: ./pocketmine-mp diff --git a/changelogs/4.12.md b/changelogs/4.12.md index ab233e6ca..ab96c2082 100644 --- a/changelogs/4.12.md +++ b/changelogs/4.12.md @@ -69,4 +69,27 @@ Released 9th January 2023. ## Fixes - Fixed players getting kicked during PvP. -- Fixed players randomly getting kicked on Windows (improper rate limit handling wrt. 15ms timer resolution). \ No newline at end of file +- Fixed players randomly getting kicked on Windows (improper rate limit handling wrt. 15ms timer resolution). + +# 4.12.9 +Released 16th January 2023. + +## Improvements +### Timings +- Added new timers: + - `Server Mid-Tick Processing` - time spent processing Snooze interrupts between ticks (e.g. incoming network packets) + - `Server Tick Update Cycle` - time spent processing regular per-tick updates (e.g. entity movement, world updates, etc.) (`Server->tick()`) +- `Full Server Tick` timer now counts the total of `Server Mid-Tick Processing` and `Server Tick Update Cycle`, which generates more accurate performance metrics. + - Previously, this timer only counted the time spent during regular per-tick updates, and the time recorded by `Server Mid-Tick Processing` was not included in the report at all. + +## Fixes +- Fixed blocks such as pressure plates being able to be placed without the correct supporting blocks if the clicked block was solid. +- Pressure plates now self-destruct when the block below them is removed. +- Fixed being unable to place blocks by clicking on the side of a bell (when the click doesn't result in ringing the bell). +- Fixed various rotation-aware blocks (e.g. stairs) behaving incorrectly when placed by clicking on the side of a replaceable block (e.g. tall grass). +- Fixed banners being able to be placed on top of blocks such as skulls. +- Fixed server-side collision boxes of walls and glass (which should connect, but didn't). Note that wall connections still don't show client side - this just fixes the collision boxes. +- Fixed `PlayerInteractEvent` with `LEFT_CLICK` sometimes firing before `BlockBreakEvent` when breaking blocks. + +## Other changes +- Increased packet batch budget for player sessions. diff --git a/composer.lock b/composer.lock index b07c17156..60611b0eb 100644 --- a/composer.lock +++ b/composer.lock @@ -2309,20 +2309,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.27", + "version": "9.5.28", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -2391,7 +2391,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" }, "funding": [ { @@ -2407,7 +2407,7 @@ "type": "tidelift" } ], - "time": "2022-12-09T07:31:23+00:00" + "time": "2023-01-14T12:32:24+00:00" }, { "name": "sebastian/cli-parser", diff --git a/src/Server.php b/src/Server.php index bd20c8616..5b53b3819 100644 --- a/src/Server.php +++ b/src/Server.php @@ -91,6 +91,7 @@ use pocketmine\scheduler\AsyncPool; use pocketmine\snooze\SleeperHandler; use pocketmine\stats\SendUsageTask; use pocketmine\timings\Timings; +use pocketmine\timings\TimingsAwareSleeperHandler; use pocketmine\timings\TimingsHandler; use pocketmine\updater\UpdateChecker; use pocketmine\utils\AssumptionFailedError; @@ -771,7 +772,8 @@ class Server{ $this->tickAverage = array_fill(0, self::TARGET_TICKS_PER_SECOND, self::TARGET_TICKS_PER_SECOND); $this->useAverage = array_fill(0, self::TARGET_TICKS_PER_SECOND, 0); - $this->tickSleeper = new SleeperHandler(); + Timings::init(); + $this->tickSleeper = new TimingsAwareSleeperHandler(Timings::$serverInterrupts); $this->signalHandler = new SignalHandler(function() : void{ $this->logger->info("Received signal interrupt, stopping the server"); @@ -951,7 +953,6 @@ class Server{ ))); $this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_license($this->getName()))); - Timings::init(); TimingsHandler::setEnabled($this->configGroup->getPropertyBool("settings.enable-profiling", false)); $this->profilingTickRate = $this->configGroup->getPropertyInt("settings.profile-report-trigger", self::TARGET_TICKS_PER_SECOND); diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 90e4b50d0..9bbff9b63 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,7 +31,7 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "4.12.9"; + public const BASE_VERSION = "4.12.10"; public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index c883a7b5d..49f87793f 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -148,7 +148,7 @@ use const SORT_NUMERIC; class NetworkSession{ private const INCOMING_PACKET_BATCH_PER_TICK = 2; //usually max 1 per tick, but transactions may arrive separately - private const INCOMING_PACKET_BATCH_MAX_BUDGET = 100; //enough to account for a 5-second lag spike + private const INCOMING_PACKET_BATCH_MAX_BUDGET = 100 * self::INCOMING_PACKET_BATCH_PER_TICK; //enough to account for a 5-second lag spike /** * At most this many more packets can be received. If this reaches zero, any additional packets received will cause diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index 34313faa8..cc2c24776 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -249,20 +249,6 @@ class InGamePacketHandler extends PacketHandler{ $packetHandled = true; - $useItemTransaction = $packet->getItemInteractionData(); - if($useItemTransaction !== null){ - if(count($useItemTransaction->getTransactionData()->getActions()) > 100){ - throw new PacketHandlingException("Too many actions in item use transaction"); - } - $this->inventoryManager->addPredictedSlotChanges($useItemTransaction->getTransactionData()->getActions()); - if(!$this->handleUseItemTransaction($useItemTransaction->getTransactionData())){ - $packetHandled = false; - $this->session->getLogger()->debug("Unhandled transaction in PlayerAuthInputPacket (type " . $useItemTransaction->getTransactionData()->getActionType() . ")"); - }else{ - $this->inventoryManager->syncMismatchedPredictedSlotChanges(); - } - } - $blockActions = $packet->getBlockActions(); if($blockActions !== null){ if(count($blockActions) > 100){ @@ -283,6 +269,20 @@ class InGamePacketHandler extends PacketHandler{ } } + $useItemTransaction = $packet->getItemInteractionData(); + if($useItemTransaction !== null){ + if(count($useItemTransaction->getTransactionData()->getActions()) > 100){ + throw new PacketHandlingException("Too many actions in item use transaction"); + } + $this->inventoryManager->addPredictedSlotChanges($useItemTransaction->getTransactionData()->getActions()); + if(!$this->handleUseItemTransaction($useItemTransaction->getTransactionData())){ + $packetHandled = false; + $this->session->getLogger()->debug("Unhandled transaction in PlayerAuthInputPacket (type " . $useItemTransaction->getTransactionData()->getActionType() . ")"); + }else{ + $this->inventoryManager->syncMismatchedPredictedSlotChanges(); + } + } + return $packetHandled; } diff --git a/src/timings/Timings.php b/src/timings/Timings.php index 5d0ece80d..1f8426969 100644 --- a/src/timings/Timings.php +++ b/src/timings/Timings.php @@ -41,6 +41,8 @@ abstract class Timings{ /** @var TimingsHandler */ public static $serverTick; /** @var TimingsHandler */ + public static $serverInterrupts; + /** @var TimingsHandler */ public static $memoryManager; /** @var TimingsHandler */ public static $garbageCollector; @@ -140,7 +142,8 @@ abstract class Timings{ self::$initialized = true; self::$fullTick = new TimingsHandler("Full Server Tick"); - self::$serverTick = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Full Server Tick", self::$fullTick); + self::$serverTick = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Server Tick Update Cycle", self::$fullTick); + self::$serverInterrupts = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Server Mid-Tick Processing", self::$fullTick); self::$memoryManager = new TimingsHandler("Memory Manager"); self::$garbageCollector = new TimingsHandler("Garbage Collector", self::$memoryManager); self::$titleTick = new TimingsHandler("Console Title Tick"); diff --git a/src/timings/TimingsAwareSleeperHandler.php b/src/timings/TimingsAwareSleeperHandler.php new file mode 100644 index 000000000..80a1a0c57 --- /dev/null +++ b/src/timings/TimingsAwareSleeperHandler.php @@ -0,0 +1,47 @@ +timings->startTiming(); + try{ + parent::processNotifications(); + }finally{ + $this->timings->stopTiming(); + } + } +}