Bug 232047 - cyrus-imapd leaks filedescriptors at folder rename and delete
cyrus-imapd leaks filedescriptors at folder rename and delete
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: cyrus-imapd (Show other bugs)
4.4
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Michal Hlavinka
Brian Brock
:
Depends On:
Blocks: 253854
  Show dependency treegraph
 
Reported: 2007-03-13 14:28 EDT by Thorsten Schlichting
Modified: 2010-03-05 10:01 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-05 10:01:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Thorsten Schlichting 2007-03-13 14:28:08 EDT
Description of problem:
If a user or an administrator renames or deletes a mailbox folder with a quota
limit the imapd process keeps an filedescriptor open for each folder and all
contained subfolders.
So if you rename user/account/a/a/a into user/account/b/a/a 3 filedescriptors
are lost. Users with big folder hierarchy run out of filedescriptor when
renaming top level folders. If an administrator moves users between different
partitions (renm user/account user/account newpartition), things get more worse
because more descriptors seems to leak out and the command aborts quite soon
leaving mailboxes spread between partitions behind.   

Version-Release number of selected component (if applicable):

cyrus-imapd-2.2.12-3.RHEL4.1

How reproducible:

Make sure that a user "rztths" exists and has a quota on his inbox. Then do:
cyradm localhost --user cyrus
IMAP Password:
localhost.localdomain> lq user/rztths
 STORAGE 392087/512000 (76.5794921875%)
localhost.localdomain> cm user/rztths/a
localhost.localdomain> cm user/rztths/a/a
localhost.localdomain> cm user/rztths/a/a/a
localhost.localdomain> lsof|grep localhost|grep ESTABLISHED
mycyradm  14245   root    3u     IPv4  372137852                  TCP
localhost.localdomain:47203->localhost.localdomain:imap (ESTABLISHED)
imapd.old 14247  cyrus    0u     IPv4  372137855                  TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247  cyrus    1u     IPv4  372137855                  TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247  cyrus    2u     IPv4  372137855                  TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
sh        15437   root    3u     IPv4  372137852                  TCP
localhost.localdomain:47203->localhost.localdomain:imap (ESTABLISHED)
grep      15439   root    3u     IPv4  372137852                  TCP
localhost.localdomain:47203->localhost.localdomain:imap (ESTABLISHED)
grep      15440   root    3u     IPv4  372137852                  TCP
localhost.localdomain:47203->localhost.localdomain:imap (ESTABLISHED)
localhost.localdomain> lsof -p 14247
COMMAND     PID  USER   FD   TYPE     DEVICE     SIZE      NODE NAME
imapd.old 14247 cyrus  cwd    DIR      253,0     4096         2 /
imapd.old 14247 cyrus  rtd    DIR      253,0     4096         2 /
imapd.old 14247 cyrus  txt    REG      253,0   976740    252127
/usr/lib/cyrus-imapd/imapd.old

<some lines deleted>

imapd.old 14247 cyrus  mem    REG      253,4  1081344  10539035
/s80/data/cyrus/config/db/__db.003
imapd.old 14247 cyrus  mem    REG      253,4  1318912  10539014
/s80/data/cyrus/config/db/__db.002
imapd.old 14247 cyrus  mem    REG      253,4    16384  10539013
/s80/data/cyrus/config/db/__db.001
imapd.old 14247 cyrus    0u  IPv4  372137855                TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247 cyrus    1u  IPv4  372137855                TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247 cyrus    2u  IPv4  372137855                TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247 cyrus    3w  FIFO        0,7              18403 pipe
imapd.old 14247 cyrus    4u  IPv4      18402                TCP
localhost.localdomain:imap (LISTEN)
imapd.old 14247 cyrus    5u  unix 0xec82bd00          372137853 socket
imapd.old 14247 cyrus    6u   REG      253,4  4180400  10539067
/s80/data/cyrus/config/mailboxes.db
imapd.old 14247 cyrus    7u  unix 0xe477d900          372137854 socket
imapd.old 14247 cyrus    8u   REG      253,4      144  10539056
/s80/data/cyrus/config/annotations.db
imapd.old 14247 cyrus    9u   REG      253,4        0  12234753
/s80/data/cyrus/config/socket/imap-0.lock
imapd.old 14247 cyrus   10u   REG      253,4       34  10541035
/s80/data/cyrus/config/proc/14247
localhost.localdomain> renm user/rztths/a user/rztths/b
localhost.localdomain> exit
[root@mail2 src]# lsof -p 14247
COMMAND     PID  USER   FD   TYPE     DEVICE     SIZE      NODE NAME
imapd.old 14247 cyrus  cwd    DIR      253,0     4096         2 /
imapd.old 14247 cyrus  rtd    DIR      253,0     4096         2 /
imapd.old 14247 cyrus  txt    REG      253,0   976740    252127
/usr/lib/cyrus-imapd/imapd.old

<some lines deleted>

imapd.old 14247 cyrus  mem    REG      253,4  1081344  10539035
/s80/data/cyrus/config/db/__db.003
imapd.old 14247 cyrus  mem    REG      253,4  1318912  10539014
/localhost.localdomain> lq user/rztths
 STORAGE 392087/512000 (76.5794921875%)
localhost.localdomain> cm user/rztths/a
localhost.localdomain> cm user/rztths/a/a
localhost.localdomain> cm user/rztths/a/a/a
localhost.localdomain> lsof|grep localhost|grep ESTABLISHED
mycyradm  14245   root    3u     IPv4  372137852                  TCP
localhost.localdomain:47203->localhost.localdomain:imap (ESTABLISHED)
imapd.old 14247  cyrus    0u     IPv4  372137855                  TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247  cyrus    1u     IPv4  372137855                  TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247  cyrus    2u     IPv4  372137855                  TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
sh        15437   root    3u     IPv4  372137852                  TCP
localhost.localdomain:47203->localhost.localdomain:imap (ESTABLISHED)
grep      15439   root    3u     IPv4  372137852                  TCP
localhost.localdomain:47203->localhost.localdomain:imap (ESTABLISHED)
grep      15440   root    3u     IPv4  372137852                  TCP
localhost.localdomain:47203->localhost.localdomain:imap (ESTABLISHED)
localhost.localdomain> lsof -p 14247
COMMAND     PID  USER   FD   TYPE     DEVICE     SIZE      NODE NAME
imapd.old 14247 cyrus  cwd    DIR      253,0     4096         2 /
imapd.old 14247 cyrus  rtd    DIR      253,0     4096         2 /
imapd.old 14247 cyrus  txt    REG      253,0   976740    252127
/usr/lib/cyrus-imapd/imapd.old

<some "mem" lines deleted>

imapd.old 14247 cyrus  mem    REG      253,4  1081344  10539035
/s80/data/cyrus/config/db/__db.003
imapd.old 14247 cyrus  mem    REG      253,4  1318912  10539014
/s80/data/cyrus/config/db/__db.002
imapd.old 14247 cyrus  mem    REG      253,4    16384  10539013
/s80/data/cyrus/config/db/__db.001
imapd.old 14247 cyrus    0u  IPv4  372137855                TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247 cyrus    1u  IPv4  372137855                TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247 cyrus    2u  IPv4  372137855                TCP
localhost.localdomain:imap->localhost.localdomain:47203 (ESTABLISHED)
imapd.old 14247 cyrus    3w  FIFO        0,7              18403 pipe
imapd.old 14247 cyrus    4u  IPv4      18402                TCP
localhost.localdomain:imap (LISTEN)
imapd.old 14247 cyrus    5u  unix 0xec82bd00          372137853 socket
imapd.old 14247 cyrus    6u   REG      253,4  4180400  10539067
/s80/data/cyrus/config/mailboxes.db
imapd.old 14247 cyrus    7u  unix 0xe477d900          372137854 socket
imapd.old 14247 cyrus    8u   REG      253,4      144  10539056
/s80/data/cyrus/config/annotations.db
imapd.old 14247 cyrus    9u   REG      253,4        0  12234753
/s80/data/cyrus/config/socket/imap-0.lock
imapd.old 14247 cyrus   10u   REG      253,4       34  10541035
/s80/data/cyrus/config/proc/14247
localhost.localdomain> renm user/rztths/a user/rztths/b
localhost.localdomain> exit
[root@mail2 src]# lsof -p 14247
COMMAND     PID  USER   FD   TYPE     DEVICE     SIZE      NODE NAME
imapd.old 14247 cyrus  cwd    DIR      253,0     4096         2 /
imapd.old 14247 cyrus  rtd    DIR      253,0     4096         2 /
imapd.old 14247 cyrus  txt    REG      253,0   976740    252127
/usr/lib/cyrus-imapd/imapd.old

<some "mem" lines deleted>

imapd.old 14247 cyrus  mem    REG      253,4  1081344  10539035
/s80/data/cyrus/config/db/__db.003
imapd.old 14247 cyrus  mem    REG      253,4  1318912  10539014
/s80/data/cyrus/config/db/__db.002
imapd.old 14247 cyrus  mem    REG      253,4    16384  10539013
/s80/data/cyrus/config/db/__db.001
imapd.old 14247 cyrus    0u   CHR        1,3               2651 /dev/null
imapd.old 14247 cyrus    1u   CHR        1,3               2651 /dev/null
imapd.old 14247 cyrus    2u   CHR        1,3               2651 /dev/null
imapd.old 14247 cyrus    3w  FIFO        0,7              18403 pipe
imapd.old 14247 cyrus    4u  IPv4      18402                TCP
localhost.localdomain:imap (LISTEN)
imapd.old 14247 cyrus    5u  unix 0xec82bd00          372137853 socket
imapd.old 14247 cyrus    6u   REG      253,4  4180880  10539067
/s80/data/cyrus/config/mailboxes.db
imapd.old 14247 cyrus    7u  unix 0xe477d900          372137854 socket
imapd.old 14247 cyrus    8u   REG      253,4      144  10539056
/s80/data/cyrus/config/annotations.db
imapd.old 14247 cyrus    9uW  REG      253,4        0  12234753
/s80/data/cyrus/config/socket/imap-0.lock
imapd.old 14247 cyrus   14u   REG      253,4       17  10539839
/s80/data/cyrus/config/quota/r/user.rztths
imapd.old 14247 cyrus   15u   REG      253,4       17  12256609
/s80/data/cyrus/config/quota/r/user.rztths
imapd.old 14247 cyrus   16u   REG      253,4       17  12257598
/s80/data/cyrus/config/quota/r/user.rztths

Please look at filedescriptors 14-16, the imapd is not connected to any user but
still has open quota-Files, all with different inode numbers. 
Actual results:

Filedescriptor 14-16 open
Expected results:

Not open
Additional info:
The bug seems to be introduced by Patch3 in the .spec-File, 
http://email.uoa.gr/download/cyrus/cyrus-imapd-2.2.7/cyrus-imapd-2.2.7-rmquota+deletemailbox-0.1.diff
I've build my own version without this Patch and everything works fine.
Looking at
http://email.uoa.gr/projects/cyrus/quota-patches/deletemailbox/
shows a newer patch for cyrus 2.2.12 but I did not try it out because I
do not need this functionallity.
Comment 1 Thorsten Schlichting 2007-08-22 08:51:31 EDT
I can see the same problem on RHEL 5 with cyrus-imapd-2.3.7-1.1.el5

As before, removing Patch3 solves the problem.
Comment 2 Michal Hlavinka 2009-04-16 08:55:56 EDT
I've checked new version of the patch and it does not fix this problem
Comment 3 Michal Hlavinka 2010-03-05 10:01:57 EST
I'm sorry for not addressing the issue in RHEL-4. As cyrus-imapd
is not scheduled for update in RHEL-4.9, I'm closing that bugzilla WONTFIX. If
you are still experiencing the issue with RHEL-5, feel free to reopen it
against RHEL-5.

Note You need to log in before you can comment on or make changes to this bug.