From bbb7fea8d820263290f07d75504c1235398786f3 Mon Sep 17 00:00:00 2001 From: Seth Alter Date: Tue, 20 Jul 2021 09:47:09 -0400 Subject: [PATCH 1/3] Resend messages with missing data --- Documentation/Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/Changelog.md b/Documentation/Changelog.md index 065310165..259e2221e 100644 --- a/Documentation/Changelog.md +++ b/Documentation/Changelog.md @@ -10,6 +10,7 @@ To upgrade from TDW v1.7 to v1.8, read [this guide](Documentation/upgrade_guides - Fixed: Unhandled ArgumentException when trying to add an object with an existing ID. - Fixed: Rare object ID clashes with internal avatar ID integers. Internal avatar IDs are now far less likely to be the same as an object ID. +- Fixed: Rare bug where the build won't receive the full JSON string for very long lists of commands. In these cases, the build will request that the controller resend the message. ## v1.8.19 From 031d6f615fcc4dd8155f60e4e50d6d3eeada653c Mon Sep 17 00:00:00 2001 From: Seth Alter Date: Wed, 21 Jul 2021 09:27:45 -0400 Subject: [PATCH 2/3] Fixed ftre logic in Controller --- Python/tdw/controller.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Python/tdw/controller.py b/Python/tdw/controller.py index bfb91803b..d0c3534fc 100644 --- a/Python/tdw/controller.py +++ b/Python/tdw/controller.py @@ -10,7 +10,7 @@ from tdw.librarian import ModelLibrarian, SceneLibrarian, MaterialLibrarian, HDRISkyboxLibrarian, \ HumanoidAnimationLibrarian, HumanoidLibrarian, HumanoidAnimationRecord, RobotLibrarian from tdw.backend.paths import EDITOR_LOG_PATH, PLAYER_LOG_PATH -from tdw.output_data import OutputData, Version, QuitSignal +from tdw.output_data import Version, QuitSignal from tdw.release.build import Build from tdw.release.pypi import PyPi from tdw.version import __version__ @@ -143,14 +143,28 @@ def communicate(self, commands: Union[dict, List[dict]]) -> list: # If the controller receives the dummy object, it should re-send its commands. # The dummy object is always in an array: [ftre, 0] # This way, the controller can easily differentiate it from a response that just has the frame count. - while len(resp) > 1 and OutputData.get_data_type_id(resp[0]) == "ftre": - self.socket.send_multipart(msg) - resp = self.socket.recv_multipart() + ftre: bool = True + num_ftre: int = 0 + while ftre and num_ftre < 1000: + ftre = False + for i in range(len(resp) - 1): + if resp[i][4:8] == b'ftre': + ftre = True + self.socket.send_multipart(msg) + resp = self.socket.recv_multipart() + num_ftre += 1 + break + # Tried too many times. + if ftre: + print("Quitting now because the controller tried too many times to resend commands to the build. " + "Check the build log for more info.") + self._print_build_log() + self._local_build_is_running = False + self._quit = True # Check if we've received a quit signal. If we have, check if there was an error. for i in range(len(resp) - 1): - r_id = OutputData.get_data_type_id(resp[i]) - if r_id == "quit": + if resp[i][4:8] == b'quit': if not QuitSignal(resp[i]).get_ok(): print("The build quit due to an error. Check the build log for more info.") self._print_build_log() From 9dacb91988c882f408d497df4957de828fbf0b33 Mon Sep 17 00:00:00 2001 From: Seth Alter Date: Mon, 26 Jul 2021 11:20:41 -0400 Subject: [PATCH 3/3] version --- Documentation/Changelog.md | 8 +++++++- Python/setup.py | 2 +- Python/tdw/version.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Documentation/Changelog.md b/Documentation/Changelog.md index 430f96bb9..f3941c982 100644 --- a/Documentation/Changelog.md +++ b/Documentation/Changelog.md @@ -4,6 +4,13 @@ To upgrade from TDW v1.7 to v1.8, read [this guide](Documentation/upgrade_guides/v1.7_to_v1.8). +## v1.8.21 + +### Build + +- Fixed: Rare bug where the build won't receive the full JSON string for very long lists of commands. In these cases, the build will request that the controller resend the message. +- Fixed: Rare bug in which the controller enters an infinite loop trying to resend messages to the build. Now, it will quit with an error after a certain number of retries. + ## v1.8.20 ### Command API @@ -40,7 +47,6 @@ To upgrade from TDW v1.7 to v1.8, read [this guide](Documentation/upgrade_guides - Fixed: Unhandled ArgumentException when trying to add an object with an existing ID. - Fixed: Rare object ID clashes with internal avatar ID integers. Internal avatar IDs are now far less likely to be the same as an object ID. -- Fixed: Rare bug where the build won't receive the full JSON string for very long lists of commands. In these cases, the build will request that the controller resend the message. ### Example Controllers diff --git a/Python/setup.py b/Python/setup.py index 775c26f1d..d228a0cf7 100644 --- a/Python/setup.py +++ b/Python/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages from pathlib import Path -__version__ = "1.8.20.0" +__version__ = "1.8.21.0" readme_path = Path('../README.md') if readme_path.exists(): long_description = readme_path.read_text(encoding='utf-8') diff --git a/Python/tdw/version.py b/Python/tdw/version.py index b0131038c..003f37b00 100644 --- a/Python/tdw/version.py +++ b/Python/tdw/version.py @@ -1 +1 @@ -__version__ = "1.8.20" +__version__ = "1.8.21"