From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/65052 Path: news.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.gnus.general Subject: Re: closing all inactive server connections Date: Wed, 15 Aug 2007 13:28:44 +0200 Message-ID: <87zm0tyr2r.fsf@mocca.josefsson.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1187177414 30247 80.91.229.12 (15 Aug 2007 11:30:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Aug 2007 11:30:14 +0000 (UTC) Cc: ding@gnus.org To: Katsumi Yamaoka Original-X-From: ding-owner+M13562@lists.math.uh.edu Wed Aug 15 13:30:09 2007 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1ILH4f-0004n7-Lt for ding-account@gmane.org; Wed, 15 Aug 2007 13:30:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1ILH3g-0007lR-JK; Wed, 15 Aug 2007 06:29:04 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1ILH3e-0007l7-FJ for ding@lists.math.uh.edu; Wed, 15 Aug 2007 06:29:02 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1ILH3b-0008PT-7H for ding@lists.math.uh.edu; Wed, 15 Aug 2007 06:29:02 -0500 Original-Received: from yxa.extundo.com ([83.241.177.38]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1ILH3V-0001ll-00 for ; Wed, 15 Aug 2007 13:28:53 +0200 Original-Received: from mocca.josefsson.org (yxa.extundo.com [83.241.177.38]) (authenticated bits=0) by yxa.extundo.com (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id l7FBSiNV023172 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 15 Aug 2007 13:28:46 +0200 OpenPGP: id=B565716F; url=http://josefsson.org/key.txt Mail-Copies-To: nobody X-Hashcash: 1:22:070815:ding@gnus.org::t8n16vrt/3BoaZzv:3+Do X-Hashcash: 1:22:070815:yamaoka@jpl.org::cq/7sOsKEi5T4FKQ:e/SP In-Reply-To: (Katsumi Yamaoka's message of "Tue, 31 Jul 2007 17:52:42 +0900") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux) X-Spam-Status: No, score=-1.1 required=4.0 tests=AWL,BAYES_40, FORGED_RCVD_HELO,SPF_PASS autolearn=ham version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on yxa-iv X-Virus-Scanned: ClamAV version 0.88.2, clamav-milter version 0.88.2 on yxa.extundo.com X-Virus-Status: Clean X-Spam-Score: -2.5 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:65052 Archived-At: Katsumi Yamaoka writes: > Well, I tried looking into the IMAP code although I've never > used nnimap. And I found the functions that communicate with > the server all have the following form: > > (while (and (memq (process-status PROCESS) '(open run)) > (wait-for-a-string-that-the-PROCESS-returns)) > (accept-process-output PROCESS 1) > (sit-for 1)) > > This can be an infinite loop if the process-status keeps `open' > or `run' even though the connection has actually died. Can that happen? Wouldn't that be an emacs bug? Shouldn't process-status return exit or closed if a connect/process has gone away? > In particular, the `imap-wait-for-tag' function can be the cause of > the hanging since it sends the LOGOUT command to the dead server and > waits for the response. So, I tried modifying it so as to quit in a > certain time. The patch to imap.el is below. Anyway, it needs to be > reviewed by someone who is skilled in IMAP. The default value of > `imap-timeout-seconds' might be too small for slow connections. > > --- imap.el~ 2007-01-24 07:15:37 +0000 > +++ imap.el 2007-07-31 08:50:30 +0000 > @@ -1182,14 +1182,25 @@ > imap-server auth))))) > imap-state)))) > > +(defvar imap-timeout-seconds 1 > + "*Number of seconds in which `imap-close' gives up working.") This is a bad idea even for fast servers -- some operations (such as deleting or renaming a mailabox) can take several minutes. Gnus shouldn't assume the server isn't responding in this (and other) cases. Ted Zlatanov writes: > Maybe it should be generalized, however, to an IMAP timeout per (server, > group name, command) combination (as a regex or a function), so you can > assign "LOGOUT" a longer timeout with a slower server. This could also > be a server tuning parameter for nnimap instead of an imap.el parameter. Having the timeout be restricted to just LOGOUT seems to make more sense to me. If the server doesn't respond to a LOGOUT within a short period of time, one might as well disconnect. /Simon