From ddc879cd601658faf25fcc0aa25f31597a539e64 Mon Sep 17 00:00:00 2001 From: Prabhakar Kumar Date: Mon, 16 Dec 2024 12:44:08 +0000 Subject: [PATCH 1/3] Removes the unused composite action to build and publish to PyPI. --- .../actions/build_and_publish_pypi/action.yml | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 .github/actions/build_and_publish_pypi/action.yml diff --git a/.github/actions/build_and_publish_pypi/action.yml b/.github/actions/build_and_publish_pypi/action.yml deleted file mode 100644 index 372b880c..00000000 --- a/.github/actions/build_and_publish_pypi/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2020-2024 The MathWorks, Inc. - -# Composite Action to Build and Publish in PyPi -name: Build and Publish in PyPi -runs: - using: "composite" - steps: - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: '3.8' - - - name: Install Python build dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install wheel - shell: bash - - - name: Build Source and Binary wheel distributions - run: python3 setup.py bdist_wheel sdist - shell: bash - - - name: Publish to PyPI. - uses: pypa/gh-action-pypi-publish@release/v1 From 935dc41a2e87d38027cba3556de1172d9f741128 Mon Sep 17 00:00:00 2001 From: Krishan Sharma Date: Fri, 20 Dec 2024 01:19:35 +0000 Subject: [PATCH 2/3] Fixes hang when stopping MATLAB from matlab-proxy. This issue usually only occurs when MATLAB cold starts for the first time through matlab-proxy. In this state, the matlab-proxy process shares a pipe with the MathWorksServiceHost process and waits for ever for that pipe to close. This change closes the shared stderr pipe before waiting for MATLAB to terminate. fixes mathworks/matlab-proxy#44 --- matlab_proxy/app_state.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/matlab_proxy/app_state.py b/matlab_proxy/app_state.py index 42ae7523..6a86e50f 100644 --- a/matlab_proxy/app_state.py +++ b/matlab_proxy/app_state.py @@ -1427,11 +1427,26 @@ async def stop_matlab(self, force_quit=False): else: logger.debug("Sending HTTP request to stop the MATLAB process...") try: + import sys + # Send HTTP request await self.__send_stop_request_to_matlab() + # Close the stderr stream to prevent indefinite hanging on it due to a child + # process inheriting it, fixes https://github.com/mathworks/matlab-proxy/issues/44 + stderr_stream = matlab._transport.get_pipe_transport( + sys.stderr.fileno() + ) + if stderr_stream: + logger.debug( + "Closing matlab process stderr stream: %s", + stderr_stream, + ) + stderr_stream.close() + # Wait for matlab to shutdown gracefully await matlab.wait() + assert ( matlab.returncode == 0 ), "Failed to gracefully shutdown MATLAB via the embedded connector" From 6b421763bd277586be837ddb253f414446fb5c1e Mon Sep 17 00:00:00 2001 From: Prabhakar Kumar Date: Fri, 20 Dec 2024 06:51:26 +0530 Subject: [PATCH 3/3] Update to v0.23.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 75f928a7..acbbb82c 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ def run(self): setuptools.setup( name="matlab-proxy", - version="0.23.3", + version="0.23.4", url=config["doc_url"], author="The MathWorks, Inc.", author_email="cloud@mathworks.com",