Open didacarbones opened 3 weeks ago
I think adding an option to the ClientConfig
makes sense to shorten the time It would be nice to find out why something is taking 5 minutes to disconnect though, maybe the default doesn't make too much sense and we should just leave the server to reap any outstanding connections and keep our tidy up to be around 1-5 seconds.
Sounds good. Shall I make a PR, or is is something you'd want to tackle?
If you feel up to doing it then that would be great. Otherwise I’ll get to it when I can find the time.
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:This piece of code is reached
atexit
after callingsmbclient.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 ofreset_connection_cache
over, and passing atimeout
to theconnection.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 inClientConfig
, and using that inreset_connection_cache
. I would imagine a sensible default would be 3-5 seconds.