I was looking at a mail folder and I noted that a file in the inbox had a total of 11 hard links to it:
👹 # exa -lH cur/1564249738.M167990P53982.mail.covisp.net,S=8572,W=8738:2,Sgl .rw------- 11 8.6k vpopmail 19 Jul 19:59 cur/1564249738.M167990P53982.mail.covisp.net,S=8572,W=8738:2,Sgl
👹 # find . -samefile cur/1564249738.M167990P53982.mail.covisp.net,S=8572,W=8738:2,Sgl [6:59] [/usr/local/virtual/kreme@kreme.com/Maildir] ./.Junk/cur/1564253637.M808919P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564253637.M808920P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564253723.M977674P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564253723.M977675P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564253723.M977676P50422.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1563587951.M591499P47868.mail.covisp.net,S=8572,W=8738:2, ./.Junk/cur/1564851795.M381461P10380.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564851795.M381462P10380.mail.covisp.net,S=8572,W=8738:2,bc ./.Junk/cur/1564852369.M760020P10380.mail.covisp.net,S=8572,W=8738:2,bc ./.Trash/cur/1563587951.M591499P47868.mail.covisp.net,S=8572,W=8738:2,S ./cur/1564249738.M167990P53982.mail.covisp.net,S=8572,W=8738:2,Sgl
A bit of background: a few weeks ago I had thousands of files in the mail store that had hundreds of links, and I got that all cleaned up through juggling some grep and awk to delete all but one of the linked files. I figured this was caused by something I’d done when I moved local users into being virtual users and eliminated pam authentication in favor of sql. But this gives me pause.
I think it’s normal for a file in the INBOX that is marked as junk or as deleted to have a single hard link (or at least it is since the default was set to maildir_copy_with_hardlinks), but 11?
And when do these hard links get cleaned off? If I delete the trashed and junked messages, when does dovecot go through and removed the linked files in the cur/ folder?
(It’s not immediate, I trashed those copies in Junk and Trash and the original file is still in the cur folder)
-- There is nothing so stupid that some person somewhere will not, with earnestness, say it.
On 16 Aug 19, at 07:33 , @lbutlr kremels@kreme.com wrote:
I was looking at a mail folder and I noted that a file in the inbox had a total of 11 hard links to it:
Ack. I checked the junk folder and there are 379 files in there with 379 links!
Since they were all in jink I just deleted them all, but that cannot possibly be desired behavior.
What do I check here?
-- Wonderful girl! Either I'm going to kill her or I'm beginning to like her.
On 17 Aug 2019, at 1.57, @lbutlr via dovecot dovecot@dovecot.org wrote:
On 16 Aug 19, at 07:33 , @lbutlr kremels@kreme.com wrote:
I was looking at a mail folder and I noted that a file in the inbox had a total of 11 hard links to it:
Ack. I checked the junk folder and there are 379 files in there with 379 links!
Since they were all in jink I just deleted them all, but that cannot possibly be desired behavior.
What do I check here?
Hard links are created when a mail is copied with the IMAP COPY command. So Dovecot just does what the client asks it to do. Maybe you have some misbehaving IMAP client?
On 17 Aug 19, at 10:14 , Timo Sirainen timo@sirainen.com wrote:
Hard links are created when a mail is copied with the IMAP COPY command. So Dovecot just does what the client asks it to do. Maybe you have some misbehaving IMAP client?
Maybe. Heck, I’ll grant probably, even.
But what do I do about it? How can I see when and where Dovecot is making hundreds of hard links to single messages? And when I have 379 hard links in a single folder all linking in the same Maildir folder that isn’t an IMAP COPY, can it?
👹 # find . -samefile cur/1564791714.M272226P99946.mail.covisp.net,S=8572,W=8738:2,Sbm ./cur/1564212774.M188126P73039.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564249810.M383378P61816.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564249870.M645963P63778.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564249931.M726654P10909.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564249992.M167306P22041.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250054.M627856P36026.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250120.M344375P57372.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250184.M87018P78868.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250244.M239686P97249.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250307.M256738P32251.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250369.M562195P60508.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250432.M269767P89961.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250493.M348431P23010.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250554.M213392P36137.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250614.M852674P98300.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250701.M145311P56821.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250788.M796958P24655.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250850.M154873P76505.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250910.M858640P38368.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564251004.M975829P24042.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564251099.M801627P27707.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564251204.M608023P48105.mail.covisp.net,S=8572,W=8738:2,Saei
Etc etc.
(Also,I have tried two find the mappings for the ,Sbm and ,Saei but I do not have a dovecot-keywords file on my system anywhere (according to locate at least). I mean, I know S is Seen, but abeim are a mystery.)
On 17/08/2019 21:27 @lbutlr via dovecot dovecot@dovecot.org wrote:
On 17 Aug 19, at 10:14 , Timo Sirainen timo@sirainen.com wrote:
Hard links are created when a mail is copied with the IMAP COPY command. So Dovecot just does what the client asks it to do. Maybe you have some misbehaving IMAP client?
Maybe. Heck, I’ll grant probably, even.
But what do I do about it? How can I see when and where Dovecot is making hundreds of hard links to single messages? And when I have 379 hard links in a single folder all linking in the same Maildir folder that isn’t an IMAP COPY, can it?
👹 # find . -samefile cur/1564791714.M272226P99946.mail.covisp.net,S=8572,W=8738:2,Sbm ./cur/1564212774.M188126P73039.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564249810.M383378P61816.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564249870.M645963P63778.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564249931.M726654P10909.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564249992.M167306P22041.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250054.M627856P36026.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250120.M344375P57372.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250184.M87018P78868.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250244.M239686P97249.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250307.M256738P32251.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250369.M562195P60508.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250432.M269767P89961.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250493.M348431P23010.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250554.M213392P36137.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250614.M852674P98300.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250701.M145311P56821.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250788.M796958P24655.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250850.M154873P76505.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564250910.M858640P38368.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564251004.M975829P24042.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564251099.M801627P27707.mail.covisp.net,S=8572,W=8738:2,Saei ./cur/1564251204.M608023P48105.mail.covisp.net,S=8572,W=8738:2,Saei
Etc etc.
(Also,I have tried two find the mappings for the ,Sbm and ,Saei but I do not have a dovecot-keywords file on my system anywhere (according to locate at least). I mean, I know S is Seen, but abeim are a mystery.)
You could try doveadm dump . on the directory to find out the keywords, and maybe even find out what these mysterious mails are about.
Aki
On 16 Aug 19, at 16:57 , @lbutlr kremels@kreme.com wrote:
Ack. I checked the junk folder and there are 379 files in there with 379 links!
It appears the main culprit is actually the sieve script that is supposed to mark messages moved out of the Junk box as ham. Somehow it was getting itself stuck and creating new hard links over at over. Before I for it under control, I have 240,000 “messages:” in the inbox, 141 of which were actual messages. I have disabled the sieve script and so far the problem hahasn’t reoccurred, but then the sieve script has been there a long time without issues before, so I suspect there was something else going on.
👹 # cat report-ham.sieve.disabled require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
if environment :matches "imap.mailbox" "*" { set "mailbox" "${1}"; }
if string "${mailbox}" "Trash" { stop; }
if environment :matches "imap.user" "*" { set "username" "${1}"; }
pipe :copy "sa-learn-ham.sh" [ "${username}" ];
Executed via:
plugin { … imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_from = Junk imapsieve_mailbox2_name = * … }
participants (3)
-
@lbutlr
-
Aki Tuomi
-
Timo Sirainen