From mboxrd@z Thu Jan 1 00:00:00 1970 From: marka@pobox.com (Mark Alexander) Date: Thu, 16 Apr 2009 15:05:59 -0700 Subject: [sup-talk] Possible problem with maildir ID generation Message-ID: I've been studying maildir.rb (and adding some debug code) while trying to figure out my lost message problem. I think there may be a problem with the way the internal message IDs are generated. The make_id method glues together the file timestamp and size. But I think this could lead to an out-of-order problem in the @ids array. Consider two messages that arrive in the same second, but the second message is smaller than the first. Because the message size makes up the low seven (decimal) digits of the ID, the second message, even though it arrived later, will have an ID that is less than the first message. Then suppose that sup polls the maildir directory after the first message arrives, but before the second message arrives, and sets the cur_offset to the ID of the first message. Then, the next time it polls, it will see the second message, but because its ID is less than that of the first message, it will appear before the first in the @ids array after it is sorted. So then the each method will skip the second message, because cur_offset (the ID of the first message) will be found in @ids after it. Does this scenario make sense? I have seen what appears to be one instance of this happening, though I'm still watching closely and adding more debugging code to make sure that it explains all of the lost messages.