I'm trying to use mbsync with gmail. After configuration, the first time I run mbsync -a
, all downloads smoothly. The second time, however, I get:
Socket error on imap.googlemail.com (172.253.120.16:993): timeout.
This error persists; the only way to clear it is to delete the sync state; after this, downloads run fine but of course download the entire inbox again.
As I understand it, the DNS for this hostname changes regularly; at the time I got this error I ran dig imap.googlemail.com
I got a different IP address. I'm led to suspect that the sync state caches the IP address? I'm not sure what else could cause this.
the sync state does positively have nothing to do with networking.
please add -Dn to the mbsync command line, and attach the log (or send it privately if you consider it too sensitive).
Interesting. Here's the log:
The timeout line happened soon after the 'warning' line above it.
For reference, my config:
this is concerning, because mbsync is not supposed to lose track of messages in maildir stores.
that the server simply stops responding is also concerning.
please attach the log with -D (not -Dn) of the initial sync, and then the first followup sync.
also, consider using a build from git master, at least for testing purposes.
Here's the tail of the log with
-D
:The 'lost track' messages appear every time I run mbsync. Shout if you need the complete log.
I have seen posts that suggest extending receive timeouts with Gmail specifically. Sadly I didn't save the URLs but if I find more links and numbers I'll add these.
fwiw, upon re-inspection i see that the error in this log occurs while uploading a 18MB message. there was a bug which would cause spurious timeouts in this situation, but it's supposed to be fixed in v1.3.2. so this suggests that this is a seemingly unmotivated timeout as in the original report, even though it appears in a completely different situation. this suggests a problem with the network connection.
yes, i need complete logs of both the initial sync of a mailbox and the followup sync. otherwise i cannot reconstruct the chain of events.
I'm having the same issue, but with mailbox.org. Is it okay if I post my logs?
sure
Sorry, it now seems to be complaining about not being able to open far side boxes.
Last edit: Oswald Buddenhagen 2021-05-08
two things:
- when you post a lot of text, make an attachment instead of pasting it inline
- when you realize that it doesn't seem to be the same issue after all, start from scratch instead of going off-topic on the existing issue
Last edit: Oswald Buddenhagen 2021-05-08
Sorry about that. The other issue is gone anyway. Here's the log files:
ok, so how you trigger this is that you delete a lot of local mails. the timeout occurs while mbsync is pushing the deletions to the far side. the flags actually get updated, but mbsync doesn't see the confirmations any more.
it would be interesting to know the timing of this. when you run with -Dn interactively, does progress suddenly just stop before the timeout occurs 20 secs later? or does the message come out of the blue while everything seems to be going nicely?
The former. It will be going about its business, and then it just freezes for about 20 seconds and throws the socket timeout error.
Last edit: Pope Rigby 2021-05-09
ok, that's a genuine timeout then. let's find out what is triggering it.
first, try sidestepping mbsync's use of openssl:
Tunnel "openssl s_client -connect imap.mailbox.org:993 -quiet -no_ign_eof"
second, try disabling compression:
DisableExtension COMPRESS
It's saying
Unrecognized IMAP extension 'COMPRESS'
with this config file:oh, that's because it actually needs to be the full string, COMPRESS=DEFLATE.
It throws a socket error:
works for me. what does
openssl version
say? maybe you have a stray outdated copy lying around? check ldd on mbsync and openssl,.OpenSSL 1.1.1k 25 Mar 2021
I'm not familiar with that, but it doesn't look like I do. Here's the output:
err, i should pay more attention to the error messages. you need to disable ssl in mbsyncrc, otherwise it tries to talk to the tunnel via ssl.
That actually seems to work. Here's the log:
the only thing the log helps is to tell me that you applied both workarounds, which isn't a useful first step - you need to try one of the suggested workarounds at a time and see which one(s) change(s) something, or if really both are needed.
the next step would be sniffing the network connections with wireshark to see where communication breaks down, and compare it with a healthy log - in case there is a clue before the actual breakdown.
Oops, sorry about that. I'm really confused now, though. I tried with and without SSL and compression, and those both worked just fine. Why is it working now?
yeah, exactly. ;)
there are several plausible theses:
- something is broken in mbsync's stacking of ssl and compression
- the same, but on the server side, and the openssl command's mildly different behavior is sufficient to sidestep the issue
- the server or network route is broken in a completely unrelated way, and just slightly changing the client behavior in whichever way is enough to sidestep the problem.
to be clear, identifying the root cause would be hard, so unless you're in for quite the learning experience, i'd recommend to just let it be and live with either workaround (disabling compression seems cleaner).