From raison at chatsubo.net Mon Jul 14 18:22:41 2008 From: raison at chatsubo.net (Kevin Raison) Date: Mon, 14 Jul 2008 11:22:41 -0700 Subject: [mel-base-devel] closing imap folder handles Message-ID: <487B9971.6050700@chatsubo.net> 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 From raison at chatsubo.net Fri Jul 18 03:37:30 2008 From: raison at chatsubo.net (Kevin Raison) Date: Thu, 17 Jul 2008 20:37:30 -0700 Subject: [mel-base-devel] closing imap folder handles In-Reply-To: <487B9971.6050700@chatsubo.net> References: <487B9971.6050700@chatsubo.net> Message-ID: <48800FFA.4020306@chatsubo.net> 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 > From js at codeartist.org Fri Jul 18 04:55:58 2008 From: js at codeartist.org (Jochen Schmidt) Date: Fri, 18 Jul 2008 06:55:58 +0200 Subject: [mel-base-devel] closing imap folder handles In-Reply-To: <48800FFA.4020306@chatsubo.net> References: <487B9971.6050700@chatsubo.net> <48800FFA.4020306@chatsubo.net> Message-ID: <7A204868-8281-4DC0-87C8-2CBE67D43BF7@codeartist.org> Yes I think thats the best way to do it. Thanks for the patch, Jochen -- Jochen Schmidt CRISPYLOGICS Julienstr. 1, 90419 N?rnberg Fon: +49 (0)911 517 999-82 Fax: +49 (0)911 517 999-83 mailto:info at crispylogics.com http://www.crispylogics.com Am 18.07.2008 um 05:37 schrieb Kevin Raison : > 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 > _______________________________________________ > mel-base-devel mailing list > mel-base-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/mel-base-devel