From def811bd08490249a572b1cf067a3c936355a738 Mon Sep 17 00:00:00 2001 From: "Charles P. Wright" Date: Mon, 15 Jul 2024 13:53:16 -0400 Subject: [PATCH 1/2] Update README.md (#4) --- python-server-plugin/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python-server-plugin/README.md b/python-server-plugin/README.md index 25228a6..1abb810 100644 --- a/python-server-plugin/README.md +++ b/python-server-plugin/README.md @@ -4,8 +4,9 @@ This is an example server-side plugin for Deephaven, providing both a Python cla To install directly to the current venv, invoke `pip install .` from within this directory. -To build the wheel, invoke `python -m build`. Then install the wheel created in `dist/` to -the venv that will be used by the server. +To build the wheel, invoke `python -m build` (you may need to run `pip install build` if the build module is not +already installed in your environment). Then install the wheel created in `dist/` to the venv that will be used +by the server. Once the server is running, the server should have an instance of `dhexample.rpc_pickle_server.RemoteShell` created and bound in the global scope so that clients can reference it by name. Construct the instance From a740eb73c71c183f8b66a41daabce0c369718200 Mon Sep 17 00:00:00 2001 From: Chip Kent <5250374+chipkent@users.noreply.github.com> Date: Mon, 15 Jul 2024 14:41:23 -0400 Subject: [PATCH 2/2] bug: fix plugin deadlock (#5) * bug: fix plugin deadlock * server side of the fix --- python-client-plugin/dhexample/rpc_pickle_client/__init__.py | 2 ++ python-server-plugin/dhexample/rpc_pickle_server/plugin.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/python-client-plugin/dhexample/rpc_pickle_client/__init__.py b/python-client-plugin/dhexample/rpc_pickle_client/__init__.py index d45c193..a941901 100644 --- a/python-client-plugin/dhexample/rpc_pickle_client/__init__.py +++ b/python-client-plugin/dhexample/rpc_pickle_client/__init__.py @@ -44,6 +44,8 @@ def __init__(self, shell_plugin: plugin_client.PluginClient): self.type_ = shell_plugin.type_ self.ticket = shell_plugin.ticket self.shell_plugin = shell_plugin + # Consume the first (empty) payload from the server + next(self.shell_plugin.resp_stream) def run(self, func_name: str, *args): """ diff --git a/python-server-plugin/dhexample/rpc_pickle_server/plugin.py b/python-server-plugin/dhexample/rpc_pickle_server/plugin.py index ada74fe..f66caf3 100644 --- a/python-server-plugin/dhexample/rpc_pickle_server/plugin.py +++ b/python-server-plugin/dhexample/rpc_pickle_server/plugin.py @@ -9,6 +9,8 @@ class RemoteShellConnection(MessageStream): def __init__(self, shell: RemoteShell, client_connection: MessageStream): self.shell = shell self.client_connection = client_connection + # Send an empty payload to the client to acknowledge successful connection + self.client_connection.on_data(b'', []) def on_data(self, payload: bytes, references: List[Any]): result_payload, result_references = self.shell.execute(payload, references) @@ -33,4 +35,4 @@ def create_client_connection(self, obj: RemoteShell, connection: MessageStream) class RpcPicklePluginRegistration(Registration): @classmethod def register_into(cls, callback: Callback) -> None: - callback.register(RemoteShellObjectType) \ No newline at end of file + callback.register(RemoteShellObjectType)