Re: Cyrus-imapd 2.4.17: processes stick on mailbox locking resulting in total mailsystem failure

2019-02-19 Thread Ivan Kuznetsov

Hello

I have gdb'ed the locked process, backtrace is below. It seems that 
problem occurs when imapd process catch a signal when is inside malloc() 
call. The signal handler has a malloc() call too, so finally there is 
interlock between two mallocs


I have only a few time to investigate because locked processes list 
grows up dramatically. So I didn't found what the signal was. But it 
seems that there is a bug in imapd code...


(gdb) thread apply all bt

Thread 1 (Thread 0x7ff6ead5f840 (LWP 22980)):
#0  0x7ff6e83e282c in __lll_lock_wait_private () from /lib64/libc.so.6
#1  0x7ff6e835e7e5 in _L_lock_16773 () from /lib64/libc.so.6
#2  0x7ff6e835b833 in malloc () from /lib64/libc.so.6
#3  0x56193edc9910 in xzmalloc ()
#4  0x56193edb2664 in seqset_init ()
#5  0x56193ed821b0 in index_tellchanges ()
#6  0x56193ed8232b in index_check ()
#7  0x56193ed6382e in idle_update ()
#8  
#9  0x7ff6e83580f0 in _int_malloc () from /lib64/libc.so.6
#10 0x7ff6e835b7dc in malloc () from /lib64/libc.so.6
#11 0x7ff6e956f4b8 in CRYPTO_malloc () from /lib64/libcrypto.so.10
#12 0x7ff6e96397ec in EVP_PKEY_CTX_dup () from /lib64/libcrypto.so.10
#13 0x7ff6e962b360 in EVP_MD_CTX_copy_ex () from /lib64/libcrypto.so.10
#14 0x7ff6e999ab3d in tls1_mac () from /lib64/libssl.so.10
#15 0x7ff6e998db02 in ssl3_read_bytes () from /lib64/libssl.so.10
#16 0x7ff6e998a644 in ssl3_read_internal () from /lib64/libssl.so.10
#17 0x56193edb9745 in prot_fill ()
#18 0x56193eda9ad7 in getword ()
#19 0x56193ed670e7 in cmd_idle ()
#20 0x56193ed7848d in cmdloop ()
#21 0x56193ed79769 in service_main ()
#22 0x56193ed62875 in main ()


13.12.2018 17:50, Ivan Kuznetsov пишет:
Jonk, thank you for the idea. Somewhat looks strange as old mail server 
worked w/o this problem 5+ years. But the system environment changed 
dramatically, may be some filesystem quircks are significant for this 
locks...


I will try gdb'ing the process when problem occurs once more

13.12.2018 17:34, John Wade пишет:
Without running gdb on the process, I have no idea, but your problem 
sounds similar to something we hit a very long time ago:


See https://www.oakton.edu/user/3/jwade/cyrus/Readme.html

In our cases, the problem was the imapd process that was holding the 
lock was trying to obtain a second lock on the same file.   What does 
a stack trace look like on the imapd process that is holding the lock? 
It would appear the lock process has changed since I last looked at 
this, so this may not be a help at all.


Good luck,
John



On 12/13/2018 5:21 AM, Ivan Kuznetsov wrote:

Hello

We had a company mail server under Oracle Linux 6 (a clone of RHEL6) 
with cyrus-imapd 2.3.16 working for years w/o problems. There are >9M 
messages in ~9500 mailboxes in two partitions. Daily mail traffic is 
20-50K messages.


Some weeks ago we migrated the server to a new one under Oracle Linux 
7 with cyrus-imapd 2.4.17 (cyrus-imapd-2.4.17-13.el7.x86_64 rpm) and 
now have problem. Some times a week one of imapd processes locks an 
"INBOX" mailbox with corresponding 
/var/lib/imap/lock/user/.lock file and does not unlock it 
anymore. Other imapd processes trying to access this mailbox sticks 
waiting to obtain the lock. The bigger problem is that lmtpd 
processes trying to deliver new mail to this mailbox hangs too. The 
number of lmtpd processes is limited (maxchild=32) to limit the 
server load, so free lmtpd pool become empty after a time, and mail 
delivery stopsto all the mailboxes. MTA (postfix) mail queue blows up 
quickly


Example lsof output:

lmtpd   8182 cyrus   18uR  REG  249,0 0 202944402 
/var/lib/imap/lock/user/smilovsky.lock
lmtpd   8183 cyrus   18uR  REG  249,0 0 202944402 
/var/lib/imap/lock/user/smilovsky.lock
lmtpd   8187 cyrus   18uR  REG  249,0 0 202944402 
/var/lib/imap/lock/user/smilovsky.lock
lmtpd   8771 cyrus   18uR  REG  249,0 0 202944402 
/var/lib/imap/lock/user/smilovsky.lock
lmtpd   8834 cyrus   18uR  REG  249,0 0 202944402 
/var/lib/imap/lock/user/smilovsky.lock
lmtpd   9123 cyrus   18uR  REG  249,0 0 202944402 
/var/lib/imap/lock/user/smilovsky.lock
lmtpd   9631 cyrus   18uR  REG  249,0 0 202944402 
/var/lib/imap/lock/user/smilovsky.lock
lmtpd   10343 cyrus   18uR  REG  249,0 0 
202944402 /var/lib/imap/lock/user/smilovsky.lock
lmtpd   10437 cyrus   18uR  REG  249,0 0 
202944402 /var/lib/imap/lock/user/smilovsky.lock
lmtpd   11411 cyrus   18uR  REG  249,0 0 
202944402 /var/lib/imap/lock/user/smilovsky.lock
lmtpd   11413 cyrus   18uR  REG  249,0 0 
202944402 /var/lib/imap/lock/user/smilovsky.lock
lmtpd   11506 cyrus   18uR  REG  249,0 0 
202944402 /var/lib/imap/lock/user/smilovsky.lock


[root@hippo4 bin]# lsof 

Re: another problem with conversations db

2019-02-19 Thread Michael Menge

Replying to myself,

I still see

IOERROR: conversations_audit on store

and

IOERROR: conversations_audit on load



Quoting Michael Menge :


Quoting Bron Gondwana :



ctl_conversationsdb -b should update the cid. BUT - if you're  
running old mailboxes which have a format which doesn't support  
saving the CID, that would for sure break things!




I did run "reconstruct -V max" during the upgrade. So all mailboxes  
should have been updated but

checking with

mbexamine user/* | grep "  Minor Version: 12"

I found some mailboxes that where not updated correctly. I didn't  
see any errors during the
initial upgrade, but I don't have the logs anymore so i don't know  
what happened.

Any idea what could lead to "reconstruct -V max" failing for some mailboxes?

I did rerun "reconstruct -r -V max user/LoginID" for those users,  
but I had two accounts where
the reconstruct command didn't update the index for the INBOX of  
that account. Rerunning it

again did update it.

The rebuild of the conversation_db worked fine after the Index was updated..
Do this did resolve the endless loop in ctl_conversationsdb. I would suggest
to add a check for the index version in ctl_conversationsdb

I will monitor my log files if the IOERRORS will reappear, or if the  
wrong index version

was the root of that problem too.

@Bron Thanks for the help





M.MengeTel.: (49) 7071/29-70316
Universität Tübingen   Fax.: (49) 7071/29-5912
Zentrum für Datenverarbeitung  mail:  
michael.me...@zdv.uni-tuebingen.de

Wächterstraße 76
72074 Tübingen


Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus