Open pierreganty opened 11 months ago
Questions:
The warning is actually coming from ChildWatcher
: https://github.com/python/cpython/blob/v3.12.0/Lib/asyncio/unix_events.py#L1333-L1334. I think there is some missing logic w.r.t the lifecycle of event loop when child processes (hence child watcher) are used. Relevant: #241 #543
Without a reasonable reproduction, bugfix might take a bit long. Please let us know when you've got some free cycles.
My guess is that fd4247ced2b536c82fe76c52a6a6042eebb31ad4 is the relevant difference against 0.4.3. I have a proposed fix: a PR will follow (EDIT: #556), please stay tuned.
Hmm if https://github.com/neovim/pynvim/pull/556#issuecomment-1851031322 doesn't fix this, I'll need a repro to help you troubleshoot this issue. At least any traceback information will be needed.
Can you try enabling neovim logging?
$ export NVIM_PYTHON_LOG_FILE="555.log" NVIM_PYTHON_LOG_LEVEL="debug"
$ python ...<your script>...
or override asyncio's warning logger to print the detailed stacktrace information:
import functools
import logging
import asyncio.log
formatter = logging.Formatter('[%(levelname)s %(asctime)s] %(filename)s:%(lineno)d %(message)s')
ch = logging.StreamHandler()
ch.setFormatter(formatter)
asyncio.log.logger.addHandler(ch)
asyncio.log.logger.warning = functools.partial(asyncio.log.logger.warning, stack_info=True)
BTW, if you'd like to silence the warning you can do something like:
import asyncio.log
asyncio.log.logger.setLevel("ERROR")
Minimal repro:
vim = pynvim.attach('child', argv=['nvim', '--embed', '--clean', '-i', 'NONE'])
vim.close()
vim = pynvim.attach('child', argv=['nvim', '--embed', '--clean', '-i', 'NONE'])
vim.close()
# Result
Loop <_UnixSelectorEventLoop running=False closed=True debug=False> that handles pid 1048 is closed
I have a Python script that is spawning thousands of short lived
nvim
instances. With the latest release of pynvim (i.e.0.5.0
) the output gets flooded with the following messages:Is there a way to silence these messages ? A workaround, for the time being, is to downgrade to
0.4.3
.Thank you for your time and the new release.
Output of
nvim -V1 -v