[mel-base-devel] closing imap folder handles

Kevin Raison raison at chatsubo.net
Fri Jul 18 03:37:30 UTC 2008


In folders/imap/folder.lisp, I have modified close-mailbox as such:

(defun close-mailbox (folder)
   (when (eq (state folder) :connected)
     (send-command folder "c1 close")
     (process-response folder)
     (setf (state folder) :disconnected)
     ;; Added by KTR on 07/17/2008 to close the network connection.
     (close (connection folder))))

Looking through the rest of the imap-specific code, I cannot see a 
reason not to do this.  Does anyone else here know a better way to 
handle my issue?

Thanks,
Kevin Raison


Kevin Raison wrote:
> First, I wanted to thank the developers for this package.  I have been 
> using it to write a voicemail processing agent for a client and could 
> not have done it without mel.  I do have one question:  it seems that 
> imap folder connections don't actually get closed by the (close-folder) 
> function.  I have a long-running process that eventually runs out of 
> file descriptors because of too many open imap connections.  I have been 
> careful to call close-folder on each connection when I am done.  I am 
> using SBCL 1.0.17 and have not seen any other problems.  The function 
> that gets called on a periodic basis follows:
> 
> (defmethod process-user-mail ((user user))
>   (handler-case
>       (let ((mbox (mel:make-imap-folder :host (server user)
>                                         :username (username user)
>                                         :password (password user)
>                                         :mailbox "inbox")))
>         (dolist (msg (mel:messages mbox))
>           ;; do some interesting things with msg
> 
>           )
>         (mel:close-folder mbox))
>     (error (condition)
>       (logger :warning "mail check for ~a failed: ~a~%" (username user) 
> condition))))
> 
> Am I missing something?
> 
> Thanks.
> Kevin Raison
> _______________________________________________
> mel-base-devel mailing list
> mel-base-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/mel-base-devel
> 



More information about the mel-base-devel mailing list