简体   繁体   English

Gmail IMAP有时会返回错误的抓取结果

[英]Gmail IMAP is sometimes returning bad results for fetch

I'm using python to connect to gmail via IMAP. 我正在使用python通过IMAP连接到gmail。

When I do a fetch for a bunch of uids, the results sometimes contain a couple weird ones tacked on to the end. 当我对一堆uid进行读取时,结果有时会包含一些奇怪的结果。

This bug appears intermittent and started appearing sometime in the last week or so. 这个bug出现间歇性,并在上周左右开始出现。

For example I do a fetch like: 例如,我做一个像:

>>>import imaplib
>>>conn = imaplib.IMAP4_SSL('imap.gmail.com')
>>># authenticate etc
>>>conn.uid('fetch', '12,13', '(X-GM-THRID)')

I sometimes get a result like: 我有时会得到如下结果:

>>>['1 (X-GM-THRID 123123123123 UID 12)', 
    '2 (X-GM-THRID 123123123123 UID 13)', 
    '365022 (UID 601722 FLAGS (\\Seen))']

(Line breaks added for readability, ids changed from original, normally I'm fetching far more than two.) (为了便于阅读,添加了换行符,ID从原来改变了,通常我得到的远不止两个。)

This is pretty weird. 这很奇怪。 I haven't requested anything at all about the extra message. 我没有要求任何关于额外消息的内容。 Sometimes it's there, sometimes not. 有时它在那里,有时不在。 No matter what fields I fetch, the extra result (I've only ever seen one or two) never contains them, and only contains the FLAGS info. 无论我获取什么字段,额外的结果(我只见过一两个)都不会包含它们,并且只包含FLAGS信息。

Any ideas why this might be happening? 任何想法为什么会这样?

The following was posted in the IMAP Protocol mailing list earlier this week: 以下内容本周早些时候发布在IMAP协议邮件列表中:

"As of yesterday [Monday October 7th], Gmail now supports reporting flags changes anywhere we would report new/expunged messages (ie, most places its allowed by the protocol, but definitely during IDLE). Its only enabled for gmail.com users at the moment, Google Apps users will follow in a week or so, assuming we don't find any issues." “截至昨天[10月7日星期一],Gmail现在支持报告标志更改,我们会报告新的/已删除的消息(即协议允许的大多数地方,但肯定是在IDLE期间)。它仅对gmail.com用户启用目前,Google Apps用户将在一周左右的时间内关注,假设我们没有发现任何问题。“

However, there are apparently issues with the new functionality because today they said it is being rolled back: 但是,新功能显然存在问题,因为今天他们说它正在回滚:

"We're seeing several reports of programs not expected extra FETCH responses, which we rolled out on Monday. We're rolling back soon, since older versions of a very popular client are having issues (though not to our knowledge with this part of things)." “我们看到一些关于程序不期望获得额外FETCH响应的报告,我们在周一推出了。我们很快就回滚了,因为一个非常受欢迎的客户的旧版本存在问题(尽管我们不知道这部分事情)。”

-Rick -Rick

Gmail is sending you unsolicited FLAGS updates (because someone changed the message remotely). Gmail正在向您发送未经请求的FLAGS更新(因为有人远程更改了邮件)。 These aren't in response to your request, but IMAP allows the server to send you any* information at any time. 这些不是对您的请求的响应,但IMAP允许服务器随时向您发送任何*信息。 Many servers will save these unsolicited responses for IDLE or NOOP responses, but apparently Gmail does not wish to wait. 许多服务器会为IDLENOOP响应保存这些未经请求的响应,但显然Gmail不希望等待。

However, until recently (apparently?) Gmail did not send flag updates at all, only EXPUNGEs. 然而,直到最近(显然?)Gmail根本没有发送标志更新,只有EXPUNGEs。

*: There are a few rules about which responses can be sent when to avoid race conditions, but this isn't one of those. *:在避免竞争条件时,有一些关于可以发送响应的规则,但这不是其中之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM