Skip to content

Commit 268f89e

Browse files
authored
Fix: LSP server thread may be none (#7222)
Fix a small issue in #7164 which was a workaround to #7163. Logs from [this failed test](https://d38p2avprg8il3.cloudfront.net/playwright-report-14364696479-19637/index.html#?testId=a9981163c8161f46b452-f9c5484e6dc22cb7f420&q=s:flaky): ``` [Python] [positron.positron_jedilsp] WARNING | An LSP server thread already exists, shutting it down [Python] [positron.positron_jedilsp] Shutting down LSP server thread [Python] [asyncio] Close <_UnixSelectorEventLoop running=False closed=False debug=True> [Python] [ipykernel.comm] ERROR | Exception opening comm with target: positron.lsp [Python] Traceback (most recent call last): [Python] File "/home/runner/work/positron/positron/extensions/positron-python/python_files/lib/ipykernel/py3/ipykernel/comm/manager.py", line 49, in comm_open [Python] f(comm, msg) [Python] File "/home/runner/work/positron/positron/extensions/positron-python/python_files/posit/positron/lsp.py", line 43, in on_comm_open [Python] POSITRON.start(lsp_host=ip_address, shell=self._kernel.shell, comm=comm) [Python] File "/home/runner/work/positron/positron/extensions/positron-python/python_files/posit/positron/positron_jedilsp.py", line 462, in start [Python] if self._server_thread.is_alive(): [Python] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Python] AttributeError: 'NoneType' object has no attribute 'is_alive' ``` ### QA Notes e2e: @:sessions @:console
1 parent 15b431d commit 268f89e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

extensions/positron-python/python_files/posit/positron/positron_jedilsp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def start(self, lsp_host: str, shell: "PositronShell", comm: BaseComm) -> None:
459459
else:
460460
self._stop_event.set()
461461
self._server_thread.join(timeout=5)
462-
if self._server_thread.is_alive():
462+
if self._server_thread is not None and self._server_thread.is_alive():
463463
logger.warning("LSP server thread did not exit after 5 seconds, dropping it")
464464

465465
# Start Jedi LSP as an asyncio TCP server in a separate thread.

0 commit comments

Comments
 (0)