A NOTE has been added to this issue. 
====================================================================== 
http://dbmail.org/mantis/view.php?id=744 
====================================================================== 
Reported By:                niki
Assigned To:                
====================================================================== 
Project:                    DBMail
Issue ID:                   744
Category:                   IMAP daemon
Reproducibility:            N/A
Severity:                   minor
Priority:                   normal
Status:                     new
target:                      
====================================================================== 
Date Submitted:             06-Dec-08 20:59 CET
Last Modified:              07-Dec-08 12:59 CET
====================================================================== 
Summary:                    Imapd with too many open file descriptors.
Description: 
Recieved 226 lines of these in the mail log:

Dec  6 20:50:54 server dbmail/imap4d[6843]: [0x976e6d8] Error:[message]
_set_content_from_stream(+778): opening tmpfile failed: Too many open
files
Dec  6 20:50:54 server dbmail/imap4d[6843]: [0x976e798] Error:[message]
_set_content_from_stream(+778): opening tmpfile failed: Too many open
files
Dec  6 20:50:54 server dbmail/imap4d[6843]: [0x976e858] Error:[message]
_set_content_from_stream(+778): opening tmpfile failed: Too many open
files
Dec  6 20:50:54 server dbmail/imap4d[6843]: [0x976e558] Error:[message]
_set_content_from_stream(+778): opening tmpfile failed: Too many open
files

Possible a leak, or ?
I don't have any debug log for this.
====================================================================== 

---------------------------------------------------------------------- 
 niki - 06-Dec-08 21:23  
---------------------------------------------------------------------- 
I have uploaded the output of lsof on imapd, and it seems like it's failing
to close some file descriptors.

The count is currently:
[EMAIL PROTECTED]:~# lsof -p 6843 | wc -l
1071 

---------------------------------------------------------------------- 
 niki - 06-Dec-08 21:32  
---------------------------------------------------------------------- 
I restarted imapd and it started to leak file descriptors at once during
mail client activity.

So atm I would bump Reproducibility to Always if I could. 

---------------------------------------------------------------------- 
 niki - 06-Dec-08 21:54  
---------------------------------------------------------------------- 
Seems to only happen when the client fetches multi part messages 

---------------------------------------------------------------------- 
 niki - 07-Dec-08 00:08  
---------------------------------------------------------------------- 
I have made this patch which seems to fix the issue.
I will test this, but as I don't know the code I might have entered the
close() the wrong place, especially the GMime stuff above it makes me a
little uncertain. 

---------------------------------------------------------------------- 
 niki - 07-Dec-08 12:59  
---------------------------------------------------------------------- 
Well it didn't, so forget about it.

But I have applied this change:

diff --git a/src/dbmail-message.c b/src/dbmail-message.c
index 203194d..d6ca4a8 100644
--- a/src/dbmail-message.c
+++ b/src/dbmail-message.c
@@ -772,6 +772,8 @@ static int _set_content_from_stream(DbmailMessage
*self, GMimeStream *stream, db
 
                        // stream -> bstream (buffer) -> fstream (filter)
-> mstream (in-memory copy)
                        bstream =
g_mime_stream_buffer_new(stream,GMIME_STREAM_BUFFER_BLOCK_READ);
+
+                       assert(!tmp); // Test to make sure that we are not
leaking files.
                        tmp = tmpfile(); 
                        if (! tmp) {
                                int serr = errno;


And now both imapd and lmptd aborts.
Am I completly off track here, or am I just failing to see the error ?

I'll stop "spamming" you now until I get some feedback :-) 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-Dec-08 20:59 niki           New Issue                                    
06-Dec-08 21:05 jasb           Issue Monitored: jasb                        
06-Dec-08 21:20 niki           File Added: imapd-lsof-1.bz2                    
06-Dec-08 21:23 niki           Note Added: 0002690                          
06-Dec-08 21:32 niki           Note Added: 0002691                          
06-Dec-08 21:54 niki           Note Added: 0002692                          
06-Dec-08 23:46 niki           File Added:
744-dbmail-filedescriptor-leak-fix.patch                    
07-Dec-08 00:08 niki           Note Added: 0002693                          
07-Dec-08 12:59 niki           Note Added: 0002696                          
======================================================================

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to