From 4fb48c5654d9ffbffbdcdd80d0498b1ea3c8e68b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 3 May 2022 15:08:35 +0200 Subject: feat(server): set $NVIM, unset $NVIM_LISTEN_ADDRESS #11009 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PROBLEM ------------------------------------------------------------------------ $NVIM_LISTEN_ADDRESS has conflicting purposes as both a parameter ("the current process should listen on this address") and a descriptor ("the current process is a child of this address"). This contradiction means the presence of NVIM_LISTEN_ADDRESS is ambiguous, so child Nvim always tries to listen on its _parent's_ socket. This is the cause of lots of "Failed to start server" spam in our test/CI logs: WARN 2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-4480-0 WARN 2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-2168-0 SOLUTION ------------------------------------------------------------------------ 1. Set $NVIM to the parent v:servername, *only* in child processes. - Now the correct way to detect a "parent" Nvim is to check for $NVIM. 2. Do NOT set $NVIM_LISTEN_ADDRESS in child processes. 3. On startup if $NVIM_LISTEN_ADDRESS exists, unset it immediately after server init. 4. Open a channel to parent automatically, expose it as v:parent. Fixes #3118 Fixes #6764 Fixes #9336 Ref https://github.com/neovim/neovim/pull/8247#issuecomment-380275696 Ref #8696 --- test/functional/ui/screen.lua | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'test/functional/ui') diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index e8a39ab6f8..80dba70b33 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -75,7 +75,7 @@ local busted = require('busted') local deepcopy = helpers.deepcopy local shallowcopy = helpers.shallowcopy local concat_tables = helpers.concat_tables -local request, run_session = helpers.request, helpers.run_session +local run_session = helpers.run_session local eq = helpers.eq local dedent = helpers.dedent local get_session = helpers.get_session @@ -90,8 +90,6 @@ end local Screen = {} Screen.__index = Screen -local debug_screen - local default_timeout_factor = 1 if os.getenv('VALGRIND') then default_timeout_factor = default_timeout_factor * 3 @@ -123,18 +121,6 @@ do Screen.colornames = colornames end -function Screen.debug(command) - if not command then - command = 'pynvim -n -c ' - end - command = command .. request('vim_eval', '$NVIM_LISTEN_ADDRESS') - if debug_screen then - debug_screen:close() - end - debug_screen = io.popen(command, 'r') - debug_screen:read() -end - function Screen.new(width, height) if not width then width = 53 -- cgit