Gnus development mailing list
 help / color / mirror / Atom feed
From: Wolfram Fenske <Wolfram.Fenske@Student.Uni-Magdeburg.DE>
Cc: Simon Josefsson <jas@extundo.com>
Subject: FIXED (was: Fwd: Updating Inbox hangs (and I know why))
Date: Thu, 22 Dec 2005 00:53:15 +0100	[thread overview]
Message-ID: <84u0d2yplg.fsf_-_@www.uni-magdeburg.de> (raw)
In-Reply-To: <ilu3bkvebn2.fsf@latte.josefsson.org> (Simon Josefsson's message of "Wed, 14 Dec 2005 20:12:17 +0100")

Hello!

I have figured out a solution now: when imap-wait-for-tag discovers that the imap process has exited, it throws an exception. nnimap-request-update-info-internal catches it. If an exception occurred, nnimap-request-update-info-internal closes the current connection, opens a new one and starts itself again. If no exception occurred, it behaves as usual.

Here's what I did to imap.el, revision 1.26:

1810a1811,1812
>       (unless (memq (process-status imap-process) '(open run))
>           (throw :process-dead :process-dead))

and to nnimap.el, revision 1.29:

1119c1119
< (deffoo nnimap-request-update-info-internal (group info &optional server)
---
> (deffoo nnimap-request-update-info-internal-1 (group info &optional server)
1180a1181,1191
> (deffoo nnimap-request-update-info-internal (group info &optional server)
>   (let ((main (lambda () (nnimap-request-update-info-internal-1 
>                         group info server))))
>     (let ((result (catch :process-dead (funcall main))))
>       (if (eql result :process-dead)
>         (with-current-buffer nnimap-server-buffer
>           (nnimap-close-server server)
>           (nnimap-open-connection server)
>           (funcall main))
>       result))))
> 

This patch makes nnimap do exactly what I want it to: use the current connection if possible and open a new one if it died. Maybe my solution isn't a clean way to do that, but so far, it seems to work OK.

I still have some related problems, though. E.g. when I exit the summar buffer after longer period of time, my exception from imap.el also gets thrown but naturally isn't caught. I suppose this function has the same problem as nnimap-request-update-info-internal and could be fixed in the same way.

It's interesting that the imap process can still be alive at the beginning of nnimap-request-update-info-internal but be dead in imap-wait-for-tag, which is called by nnimap-request-update-info-internal. I guess what happens is that the server silently closes the connection, but gnutls-cli (yes, I use gnutls-cli) doesn't notice it until it tries to communicate with the server again. And when it does notice it, the imap process/gnutls-cli dies. I would like to reopen the connection directly in imap-wait-for-tag, but can't, because other functions don't realize that the process handle has changed (or something to that effect). That's why I used exceptions to do it.

What do you think? If I can help you with this issue I'd be happy to do so.

Regards
Wolfram Fenske




      reply	other threads:[~2005-12-21 23:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <84fyp2x1hg.fsf@www.uni-magdeburg.de>
2005-12-14 15:12 ` Fwd: Updating Inbox hangs (and I know why) Reiner Steib
2005-12-14 19:12   ` Simon Josefsson
2005-12-21 23:53     ` Wolfram Fenske [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84u0d2yplg.fsf_-_@www.uni-magdeburg.de \
    --to=wolfram.fenske@student.uni-magdeburg.de \
    --cc=jas@extundo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).