Description
What happened (please include outputs or screenshots):
Python hangs during garbage collection of the API client, in the __del__
method.
What you expected to happen:
Garbage collection succeeds and the process exits
How to reproduce it (as minimally and precisely as possible):
import kubernetes
client = kubernetes.config.new_client_from_config()
thread = kubernetes.client.ApisApi(client).get_api_versions(async_req=True)
del client
Anything else we need to know?:
The hang doesn't actually occur until python exits. IE, with the following script:
import kubernetes
client = kubernetes.config.new_client_from_config()
thread = kubernetes.client.ApisApi(client).get_api_versions(async_req=True)
del client
print("done")
The output is as follows (I ctrl-ced twice after the process hung):
done
^CException ignored in: <bound method ApiClient.__del__ of <kubernetes.client.api_client.ApiClient object at 0x7f8f9ba67c50>>
Traceback (most recent call last):
File "/home/fabian/Envs/test/lib/python3.6/site-packages/kubernetes/client/api_client.py", line 81, in __del__
self._pool.join()
File "/usr/lib64/python3.6/multiprocessing/pool.py", line 546, in join
self._worker_handler.join()
File "/usr/lib64/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib64/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib64/python3.6/multiprocessing/util.py", line 262, in _run_finalizers
finalizer()
File "/usr/lib64/python3.6/multiprocessing/util.py", line 186, in __call__
res = self._callback(*self._args, **self._kwargs)
File "/usr/lib64/python3.6/multiprocessing/pool.py", line 582, in _terminate_pool
worker_handler.join()
File "/usr/lib64/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib64/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
Environment:
-
Kubernetes version (
kubectl version
): Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.6+2e5ed54", GitCommit:"2e5ed54", GitTreeState:"clean", BuildDate:"2019-10-10T22:04:13Z", GoVersion:"go1.12.8", Compiler:"gc", Platform:"linux/amd64"} -
OS (e.g., MacOS 10.13.6): Fedora 27 (Workstation Edition)
-
Python version (
python --version
): 2.7.15 and 3.6.6 -
Python client version (
pip list | grep kubernetes
): 10.0.1