From ba18a81e88d8e46e29cd36f82ca28f7fac620125 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 13 Jan 2023 15:28:03 +0000 Subject: [PATCH 1/8] NetworkSession: fixed rate limit getting exhausted after 2.5 seconds during PvP --- src/network/mcpe/NetworkSession.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index be2158f55..22c84844a 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 From c2c529e2da2913d38bc97371ea319751c9a072d0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 16 Jan 2023 17:32:54 +0000 Subject: [PATCH 2/8] Include Snooze interrupts in timings results fixes #5511 This requires any Timings instances to be updated to pmmp/timings@5410f624360896f408262a41a1b50a9b2753601b, otherwise the TPS reported will be incorrect. --- src/Server.php | 5 ++- src/timings/Timings.php | 5 ++- src/timings/TimingsAwareSleeperHandler.php | 47 ++++++++++++++++++++++ 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 src/timings/TimingsAwareSleeperHandler.php diff --git a/src/Server.php b/src/Server.php index a29cb29fc..b20ec0a35 100644 --- a/src/Server.php +++ b/src/Server.php @@ -90,6 +90,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; @@ -781,7 +782,8 @@ class Server{ self::$instance = $this; $this->startTime = microtime(true); - $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"); @@ -961,7 +963,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", 20); 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..29d826d94 --- /dev/null +++ b/src/timings/TimingsAwareSleeperHandler.php @@ -0,0 +1,47 @@ +timings->startTiming(); + try{ + parent::processNotifications(); + }finally{ + $this->timings->stopTiming(); + } + } +} \ No newline at end of file From 768650cee0dd90f976b6b20402b2896d5f7a8050 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 16 Jan 2023 17:46:50 +0000 Subject: [PATCH 3/8] CS --- src/timings/TimingsAwareSleeperHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timings/TimingsAwareSleeperHandler.php b/src/timings/TimingsAwareSleeperHandler.php index 29d826d94..80a1a0c57 100644 --- a/src/timings/TimingsAwareSleeperHandler.php +++ b/src/timings/TimingsAwareSleeperHandler.php @@ -44,4 +44,4 @@ final class TimingsAwareSleeperHandler extends SleeperHandler{ $this->timings->stopTiming(); } } -} \ No newline at end of file +} From 7e16f9be8f21d48cffb82e43a7929d5364b5d38e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 16 Jan 2023 17:50:11 +0000 Subject: [PATCH 4/8] InGamePacketHandler: handle block actions before use item transactions the START_BREAK and transaction to break the block may arrive in the same packet, causing events to be fired in the wrong order. fixes #5490 --- .../mcpe/handler/InGamePacketHandler.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index 2c566fd51..b83069957 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -248,20 +248,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){ @@ -282,6 +268,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; } From 95e8c68fdecaae57c4d3cd5c1b7a52c1d83f3829 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 18:06:31 +0000 Subject: [PATCH 5/8] Bump docker/build-push-action from 3.2.0 to 3.3.0 (#5513) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v3.2.0...v3.3.0) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build-docker-image.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 From b59b1e491eaa58ca05eceeef138d9fb752feed53 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 18:06:42 +0000 Subject: [PATCH 6/8] Bump phpunit/phpunit from 9.5.27 to 9.5.28 (#5514) Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.27 to 9.5.28. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.5.28/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.27...9.5.28) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 64e8d1cea..861d73ead 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", From 0eb751c1c9672e183eef758b2f4a329807340385 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 16 Jan 2023 18:25:17 +0000 Subject: [PATCH 7/8] Release 4.12.9 --- changelogs/4.12.md | 25 ++++++++++++++++++++++++- src/VersionInfo.php | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) 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/src/VersionInfo.php b/src/VersionInfo.php index 90e4b50d0..95eee9e4a 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -32,7 +32,7 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; public const BASE_VERSION = "4.12.9"; - public const IS_DEVELOPMENT_BUILD = true; + public const IS_DEVELOPMENT_BUILD = false; public const BUILD_CHANNEL = "stable"; private function __construct(){ From 0a2a6e2b3a57b8b45832186f83da79885bfb3f55 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 16 Jan 2023 18:25:20 +0000 Subject: [PATCH 8/8] 4.12.10 is next --- src/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 95eee9e4a..9bbff9b63 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,8 +31,8 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "4.12.9"; - public const IS_DEVELOPMENT_BUILD = false; + public const BASE_VERSION = "4.12.10"; + public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; private function __construct(){