vdirsyncer
vdirsyncer copied to clipboard
Add a timeout for unreachable server
I use Davmail via my company's VPN. When I'm not connected to the VPN, vdirsyncer will just hang while it tries to connect to a server it will never be able to connect to. Is there any way to tell vdirsyncer to only wait n seconds before giving up on syncing from a particular storage? Even globally, this option would be useful.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
What's the problem with vdirsyncer just timing out?
On 28 July 2015 17:39:54 CEST, Cameron Eagans [email protected] wrote:
I use Davmail via my company's VPN. When I'm not connected to the VPN, vdirsyncer will just hang while it tries to connect to a server it will never be able to connect to. Is there any way to tell vdirsyncer to only wait n seconds before giving up on syncing from a particular storage? Even globally, this option would be useful.
Reply to this email directly or view it on GitHub: https://github.com/untitaker/vdirsyncer/issues/249
Sent from my phone. Please excuse my brevity.
@cweagans ?
Basically, I'm just asking for a configurable timeout or a significantly shorter one (5 seconds?). Waiting 5 minutes or whatever it is set to is annoying when I'm trying to get things done.
Adding that option wouldn't be a big deal, but I still don't really understand why you can't just let vdirsyncer time out in the background. It's not like it's blocking you from doing any other work.
I use davmail, and it's more likely to crash if I'm not connected to my company's VPN and I try to download calendar entries. I also only use vdirsyncer in the foreground. I don't have it set up on a cron job or anything. It does actually block me for a few minutes :)
Can't you just hit ^C? I'd merge a PR for that option though.
I tried that, but it doesn't actually stop the process.
It does work if you use Python 3. I've not figured out how to fix this situation on Python 2.
@cweagans Is this still an issue? I'd like to remove Python 2 support sometime (see #219), so I'm not sure if this feature is really needed as I'm sure you can hit ^C in Py3.
Personally, I think a 5 min timeout is way too long. If you disagree, feel free to close this.
I've just looked at the requests docs, and it doesn't seem there is any timeout. I'll just leave this open for now. On the one hand I don't really want to introduce more knobs, on the other hand I don't know what a good default would be :(
I think 10-15 seconds is a reasonable default for just being able to connect to the server.
This might be bikesheding, but IMHO, 120 seconds should be fine. That would cover even very high-latency connections, but avoid an indefinite wait.
ctrl+c might not be possible everywhere; I run vdirsyncer sync via cron every five minutes, so I guess that this issue might result in some infinitely dead processed out there.
Hmm, agreed.
Maybe we should still make it configurable, like most options that remotestorage, *dav and http share.
So here's the plan: Default is 120 secs (no strong opinion) and configurable using new timeout param for the storages mentioned above. Unsure if combined parameter a la (connect_timeout, read_timeout) like it's done in requests is a good idea. Opinions?
I'm happy with that.
I experienced a vdirsyncer process that hung because of server issues for multiple hours. Should there have been a timeout? It was a problem because subsequent runs (from cron) could not proceed because of "database is locked".
As a workaround, I am now using the timeout command in my crontab to limit execution time.