From a660a25db3a1f0a38ed1028107553ff5fe7a8d75 Mon Sep 17 00:00:00 2001 From: Alexander Serkov Date: Mon, 10 Mar 2025 23:46:02 +0400 Subject: [PATCH] Fix file descriptors (sockets) leak --- autoload/youcompleteme.vim | 3 ++- python/ycm/unsafe_thread_pool_executor.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index ec8109ea24..78e2a02dac 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -773,6 +773,7 @@ function! s:AbortAutohoverRequest() abort let request = requests[ request_id ] if request.origin == 'autohover' call remove( s:pollers.command.requests, request_id ) + py3 ycm_state.FlushCommandRequest( int( vim.eval( "request_id" ) ) ) call request.callback( '' ) endif endfor @@ -1551,7 +1552,7 @@ function! s:PollCommands( timer_id ) abort " This request is done call remove( s:pollers.command.requests, request_id ) - py3 ycm_state.FlushCommandRequest( vim.eval( "request_id" ) ) + py3 ycm_state.FlushCommandRequest( int( vim.eval( "request_id" ) ) ) call request[ 'callback' ]( result ) endfor diff --git a/python/ycm/unsafe_thread_pool_executor.py b/python/ycm/unsafe_thread_pool_executor.py index 5baa11f2d3..e99e294166 100644 --- a/python/ycm/unsafe_thread_pool_executor.py +++ b/python/ycm/unsafe_thread_pool_executor.py @@ -53,6 +53,10 @@ def _worker( executor_reference, work_queue ): work_item = work_queue.get( block=True ) if work_item is not None: work_item.run() + # Delete references to object, + # whis allow remove object by GC without stuck on work_queue.get() + # on next cycle iteration. See GH-60488 + del work_item continue executor = executor_reference() # Exit if: