-
Notifications
You must be signed in to change notification settings - Fork 82
Description
I am experiencing severe delays on the main python process exiting. I can take about 5 minutes to exit. I have to force it to exit by repeatedly sending SIGINT. I can see that the exception stacktrace printed shows that it is waiting on the disconnect request response here:
iter_timeout = int(max(timeout - (time.time() - start_time), 1)) if timeout is not None else None
if not request.response_event.wait(timeout=iter_timeout):
value = request.message["message_id"].get_value()
raise SMBException(
f"Connection timeout of {timeout} seconds exceeded while waiting for a message id {value} "
"response from the server"
)
This piece of code is reached atexit after calling smbclient.reset_connection_cache. I have tried calling it myself, before exiting, or keeping a smaller connection cache as suggested in #176. I have only had success by copying the contents of reset_connection_cache over, and passing a timeout to the connection.disconnect call. I can create a PR, but I wanted to make an issue first, so we can start a discussion on whether this is a sensible thing to do. My suggestion is to add a disconnect timeout parameter in ClientConfig, and using that in reset_connection_cache. I would imagine a sensible default would be 3-5 seconds.