Gnus development mailing list
 help / color / mirror / Atom feed
* imap connections never being closed?
@ 2013-06-15 16:28 lee
  2013-08-01 14:41 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: lee @ 2013-06-15 16:28 UTC (permalink / raw)
  To: ding

Hi,

trying out the iptstate program, I noticed that there was a connection
to an IMAP server still open despite I removed the entry for that server
from ~/.gnus and had restarted gnus a long time ago.  Only after
quitting emacs altogether, the connection was finally closed.

Is emacs supposed to never close unneeded IMAP connections?


-- 
"Object-oriented programming languages aren't completely convinced that
you should be allowed to do anything with functions."
http://www.joelonsoftware.com/items/2006/08/01.html



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: imap connections never being closed?
  2013-06-15 16:28 imap connections never being closed? lee
@ 2013-08-01 14:41 ` Lars Magne Ingebrigtsen
  2013-08-01 16:13   ` Steinar Bang
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-01 14:41 UTC (permalink / raw)
  To: ding

lee <lee@yun.yagibdah.de> writes:

> trying out the iptstate program, I noticed that there was a connection
> to an IMAP server still open despite I removed the entry for that server
> from ~/.gnus and had restarted gnus a long time ago.  Only after
> quitting emacs altogether, the connection was finally closed.

Quitting Gnus should close all connections and kill off all server
buffers.  It seems to do that when I exit Gnus.

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: imap connections never being closed?
  2013-08-01 14:41 ` Lars Magne Ingebrigtsen
@ 2013-08-01 16:13   ` Steinar Bang
  2013-08-01 16:34     ` Lars Magne Ingebrigtsen
  2013-08-02 18:53     ` Julien Danjou
  0 siblings, 2 replies; 10+ messages in thread
From: Steinar Bang @ 2013-08-01 16:13 UTC (permalink / raw)
  To: ding

>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org>:

> Quitting Gnus should close all connections and kill off all server
> buffers.  It seems to do that when I exit Gnus.

If the computer is put to sleep and/or moved to a different network,
open IMAP connections seems to be stuck.

At least it used to be that way.

If I switch the nnimap servers to offline before sleeping and/or moving
the computer it doesn't seem to happen.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: imap connections never being closed?
  2013-08-01 16:13   ` Steinar Bang
@ 2013-08-01 16:34     ` Lars Magne Ingebrigtsen
  2013-08-08 21:08       ` Elias Oltmanns
  2013-08-02 18:53     ` Julien Danjou
  1 sibling, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-01 16:34 UTC (permalink / raw)
  To: ding

Steinar Bang <sb@dod.no> writes:

> If the computer is put to sleep and/or moved to a different network,
> open IMAP connections seems to be stuck.

Yes, but quitting Gnus kills off all the buffers Gnus has made, so all
connections should be killed at that point.

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: imap connections never being closed?
  2013-08-01 16:13   ` Steinar Bang
  2013-08-01 16:34     ` Lars Magne Ingebrigtsen
@ 2013-08-02 18:53     ` Julien Danjou
  2013-08-03 11:29       ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 10+ messages in thread
From: Julien Danjou @ 2013-08-02 18:53 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

On Thu, Aug 01 2013, Steinar Bang wrote:

>>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org>:
>
>> Quitting Gnus should close all connections and kill off all server
>> buffers.  It seems to do that when I exit Gnus.
>
> If the computer is put to sleep and/or moved to a different network,
> open IMAP connections seems to be stuck.
>
> At least it used to be that way.

I confirm (and suffer from it).

-- 
Julien Danjou
# Free Software hacker # freelance consultant
# http://julien.danjou.info

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: imap connections never being closed?
  2013-08-02 18:53     ` Julien Danjou
@ 2013-08-03 11:29       ` Lars Magne Ingebrigtsen
  2013-08-03 13:13         ` Julien Danjou
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-03 11:29 UTC (permalink / raw)
  To: ding

Julien Danjou <julien@danjou.info> writes:

>> If the computer is put to sleep and/or moved to a different network,
>> open IMAP connections seems to be stuck.
>>
>> At least it used to be that way.
>
> I confirm (and suffer from it).

Is there any general way to determine if a connection is "stuck"?  If
we've created a network connection, and we change IP addresses, then the
connection is AWOL and will never get any response to traffic.

Hm...

If there's no way to determine the AWOL-ness of a connection (and I
guess there isn't), but we can see that the IP address has changed, then
we should close the connection and start a new one.

That might help.  But how do we determine that the IP address has
changed?

The IP address of the host itself may also not change, but the router's
address changes, in which case we won't find that out, but it's a start,
perhaps...

A TCP level solution would be nice...

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: imap connections never being closed?
  2013-08-03 11:29       ` Lars Magne Ingebrigtsen
@ 2013-08-03 13:13         ` Julien Danjou
  2013-08-03 13:17           ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Julien Danjou @ 2013-08-03 13:13 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: ding

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

On Sat, Aug 03 2013, Lars Magne Ingebrigtsen wrote:

> Is there any general way to determine if a connection is "stuck"?  If
> we've created a network connection, and we change IP addresses, then the
> connection is AWOL and will never get any response to traffic.
>
> Hm...
>
> If there's no way to determine the AWOL-ness of a connection (and I
> guess there isn't), but we can see that the IP address has changed, then
> we should close the connection and start a new one.
>
> That might help.  But how do we determine that the IP address has
> changed?
>
> The IP address of the host itself may also not change, but the router's
> address changes, in which case we won't find that out, but it's a start,
> perhaps...
>
> A TCP level solution would be nice...

Having a configurable receive timeout may be enough. If you are not
receiving any byte in say 10 or 15 seconds, it's probably better to
reconnect. If I'm not mistaken, creating socket with a SO_RCVTIMEO
option would help to achieve that.

-- 
Julien Danjou
-- Free Software hacker - freelance consultant
-- http://julien.danjou.info

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: imap connections never being closed?
  2013-08-03 13:13         ` Julien Danjou
@ 2013-08-03 13:17           ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-03 13:17 UTC (permalink / raw)
  To: ding

Julien Danjou <julien@danjou.info> writes:

> Having a configurable receive timeout may be enough. If you are not
> receiving any byte in say 10 or 15 seconds, it's probably better to
> reconnect. If I'm not mistaken, creating socket with a SO_RCVTIMEO
> option would help to achieve that.

See http://permalink.gmane.org/gmane.emacs.devel/162401

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: imap connections never being closed?
  2013-08-01 16:34     ` Lars Magne Ingebrigtsen
@ 2013-08-08 21:08       ` Elias Oltmanns
  2013-08-12 17:20         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Elias Oltmanns @ 2013-08-08 21:08 UTC (permalink / raw)
  To: ding

(2013-08-01) Lars Magne Ingebrigtsen <larsi@gnus.org> wrote:
> Steinar Bang <sb@dod.no> writes:
>> If the computer is put to sleep and/or moved to a different network,
>> open IMAP connections seems to be stuck.
> 
> Yes, but quitting Gnus kills off all the buffers Gnus has made, so all
> connections should be killed at that point.

At least on emacs 23.3.1, quitting gnus is not even possible in these
situations. My piece of advice is this:

(defadvice nnimap-close-server (around dont-ping)
  (let ((imap-ping-server nil))
    ad-do-it))

Since I cannot test ma gnus or emacs 24.3 right now, here is the
behaviour I'm seeing---that is, not any more:
1. Open gnus and an encrypted imap connection to some remote server.
2. Cutt off the connection to the internet (shut down wlan in my case).
3. Press `q' in the group buffer. Gnus will hang at that point. Pressing
   `C-g' unfreezes emacs but leaves me int he gorup buffer, i.e. gnus
   remains active. Alternatively, killing the gnutls-cli / openssl
   process from a terminal unfreezes emacs as well und actually shuts
   down gnus.

With the hack above, quitting gnus will still hang, but pressing `C-g'
won't return to the group buffer but complete shutdown instead. Also,
setting nnimap-logout-timeout works as expected now.

Of course, the tcp approach discussed elsewhere has a much wider scope,
as would have a generic timeout based solution. Still, I wonder whether
a simple patch to nnimap-close-server would be a start to spare at least
some users' nerves. That is, if the situation in emacs 24.3 is still as
annoying as described above.

Hope that helped a bit,

Elias




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: imap connections never being closed?
  2013-08-08 21:08       ` Elias Oltmanns
@ 2013-08-12 17:20         ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-12 17:20 UTC (permalink / raw)
  To: Elias Oltmanns; +Cc: ding

Elias Oltmanns <eo@nebensachen.de> writes:

> At least on emacs 23.3.1, quitting gnus is not even possible in these
> situations. My piece of advice is this:
>
> (defadvice nnimap-close-server (around dont-ping)
>   (let ((imap-ping-server nil))
>     ad-do-it))
>
> Since I cannot test ma gnus or emacs 24.3 right now, here is the
> behaviour I'm seeing---that is, not any more:

Try Emacs 24 and see whether the problem persists there.  nnimap has
been rewritten, so if there's a bug in this area, it's probably a
different bug.  >"?

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php
  and http://lars.ingebrigtsen.no/2013/08/twenty-years-of-september.html



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-08-12 17:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-15 16:28 imap connections never being closed? lee
2013-08-01 14:41 ` Lars Magne Ingebrigtsen
2013-08-01 16:13   ` Steinar Bang
2013-08-01 16:34     ` Lars Magne Ingebrigtsen
2013-08-08 21:08       ` Elias Oltmanns
2013-08-12 17:20         ` Lars Magne Ingebrigtsen
2013-08-02 18:53     ` Julien Danjou
2013-08-03 11:29       ` Lars Magne Ingebrigtsen
2013-08-03 13:13         ` Julien Danjou
2013-08-03 13:17           ` Lars Magne Ingebrigtsen

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).