Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 232047 - cyrus-imapd leaks filedescriptors at folder rename and delete
Summary: cyrus-imapd leaks filedescriptors at folder rename and delete
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: cyrus-imapd
Version: 4.4
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Michal Hlavinka
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks: 253854
TreeView+ depends on / blocked
 
Reported: 2007-03-13 18:28 UTC by Thorsten Schlichting
Modified: 2010-03-05 15:01 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-05 15:01:57 UTC


Attachments (Terms of Use)

Description Thorsten Schlichting 2007-03-13 18:28:08 UTC
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 12:51:31 UTC
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 12:55:56 UTC
I've checked new version of the patch and it does not fix this problem

Comment 3 Michal Hlavinka 2010-03-05 15:01:57 UTC
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.