70d1e1170e
We added some code in https://github.com/spesmilo/electrum/commit/0b3a28358681a0fe101bd6fc3feb5ff981fb68ce to explicitly hold strong refs for all tasks/futures. At the time I was uncertain if that also solves GC issues with asyncio.run_coroutine_threadsafe. ref https://github.com/spesmilo/electrum/pull/9608#issuecomment-2703681663 Looks like it does. run_coroutine_threadsafe *is* going through the custom task factory. See the unit test. The somewhat confusing thing is that we need a few event loop iterations for the task factory to run, due to how run_coroutine_threadsafe is implemented. And also, the task that we will hold as strong ref in the global set is not the concurrent.futures.Future that run_coroutine_threadsafe returns. So this commit simply "fixes" the unit test so that it showcases this, and removes related, older, plumbing from util.py that we now know is no longer needed because of this.