Gnus development mailing list
 help / color / mirror / Atom feed
* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
       [not found] <m37hiya7na.fsf@quimbies.gnus.org>
@ 2010-09-06 21:41 ` Stefan Monnier
  2010-09-06 21:48   ` Lars Magne Ingebrigtsen
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Stefan Monnier @ 2010-09-06 21:41 UTC (permalink / raw)
  To: emacs-devel; +Cc: ding

> In Emacs 24, I get this message the first time I enter a Gnus group.
> What does it mean, and what can I do to make it go away?

It means just that: accept-process-output is called in a way that can
block (e.g. because some remote host doesn't respond) wit inhibit0quit
set to a non-nil value, which means that Emacs may end up frozen (with
no way to wake it up) for as long as the remote machine decides not
to answer.

IOW, maybe there should be a (with-local-quit ...) somewhere so that the
user can C-g out of such a state (or the call should have a timeout, or
inhibit-quit should not be set, ...).


        Stefan



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

* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
  2010-09-06 21:41 ` Blocking call to accept-process-output with quit inhibited!! [11 times] Stefan Monnier
@ 2010-09-06 21:48   ` Lars Magne Ingebrigtsen
  2010-09-07  7:08   ` joakim
  2010-09-07 11:54   ` Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-06 21:48 UTC (permalink / raw)
  To: ding; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> It means just that: accept-process-output is called in a way that can
> block (e.g. because some remote host doesn't respond) wit inhibit0quit
> set to a non-nil value, which means that Emacs may end up frozen (with
> no way to wake it up) for as long as the remote machine decides not
> to answer.

But all calls to `accept-process-output' in Gnus is called with a
timeout parameter, so there's no way Emacs could totally lock up.  I
think.  (It's typically called with a 0.1s or 0.01s timeout.)

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
  2010-09-06 21:41 ` Blocking call to accept-process-output with quit inhibited!! [11 times] Stefan Monnier
  2010-09-06 21:48   ` Lars Magne Ingebrigtsen
@ 2010-09-07  7:08   ` joakim
  2010-09-07 10:38     ` Stefan Monnier
  2010-09-07 11:54   ` Lars Magne Ingebrigtsen
  2 siblings, 1 reply; 10+ messages in thread
From: joakim @ 2010-09-07  7:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: ding, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> In Emacs 24, I get this message the first time I enter a Gnus group.
>> What does it mean, and what can I do to make it go away?
>
> It means just that: accept-process-output is called in a way that can
> block (e.g. because some remote host doesn't respond) wit inhibit0quit
> set to a non-nil value, which means that Emacs may end up frozen (with
> no way to wake it up) for as long as the remote machine decides not
> to answer.
>
> IOW, maybe there should be a (with-local-quit ...) somewhere so that the
> user can C-g out of such a state (or the call should have a timeout, or
> inhibit-quit should not be set, ...).

I get bitten by this quite a lot, since I'm often on a flaky 3g
line. When the link goes down, and some Emacs socket is still up, Emacs
freezes. This is quite annoying.

I suppose that the hard blocking is there to prevent data loss or
whatever, but having to kill -9 Emacs results in worse dataloss.

>
>
>         Stefan

-- 
Joakim Verona



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

* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
  2010-09-07  7:08   ` joakim
@ 2010-09-07 10:38     ` Stefan Monnier
  2010-09-07 11:11       ` joakim
  2010-09-07 18:33       ` Tom Tromey
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2010-09-07 10:38 UTC (permalink / raw)
  To: joakim; +Cc: ding, emacs-devel

>>> In Emacs 24, I get this message the first time I enter a Gnus group.
>>> What does it mean, and what can I do to make it go away?
>> It means just that: accept-process-output is called in a way that can
>> block (e.g. because some remote host doesn't respond) wit inhibit0quit
>> set to a non-nil value, which means that Emacs may end up frozen (with
>> no way to wake it up) for as long as the remote machine decides not
>> to answer.
>> IOW, maybe there should be a (with-local-quit ...) somewhere so that the
>> user can C-g out of such a state (or the call should have a timeout, or
>> inhibit-quit should not be set, ...).

> I get bitten by this quite a lot, since I'm often on a flaky 3g
> line. When the link goes down, and some Emacs socket is still up, Emacs
> freezes. This is quite annoying.

Emacs should not freeze in such a case.  IIUC most cases where this
happen are Elisp bugs (typically a missing with-local-quit or something
like that), tho there are a few cases where it's a problem at the
C level (IIRC, one such is during hostname lookup, but I don't know of
any such case once the TCP connection is established).

> I suppose that the hard blocking is there to prevent data loss or
> whatever, but having to kill -9 Emacs results in worse dataloss.

No, usually it's there because the Elisp coder is not aware of the risk
(e.g. he doesn't realize his code will be run with inhibit-quit set,
probably because he doesn't realize that this is set whenever we run
process filters, process sentinels, post-command-hook, jit-lock,
timers, and a handful other cases).


        Stefan



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

* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
  2010-09-07 10:38     ` Stefan Monnier
@ 2010-09-07 11:11       ` joakim
  2010-09-07 11:53         ` Lars Magne Ingebrigtsen
  2010-09-08  8:10         ` Stefan Monnier
  2010-09-07 18:33       ` Tom Tromey
  1 sibling, 2 replies; 10+ messages in thread
From: joakim @ 2010-09-07 11:11 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: ding, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>>> In Emacs 24, I get this message the first time I enter a Gnus group.
>>>> What does it mean, and what can I do to make it go away?
>>> It means just that: accept-process-output is called in a way that can
>>> block (e.g. because some remote host doesn't respond) wit inhibit0quit
>>> set to a non-nil value, which means that Emacs may end up frozen (with
>>> no way to wake it up) for as long as the remote machine decides not
>>> to answer.
>>> IOW, maybe there should be a (with-local-quit ...) somewhere so that the
>>> user can C-g out of such a state (or the call should have a timeout, or
>>> inhibit-quit should not be set, ...).
>
>> I get bitten by this quite a lot, since I'm often on a flaky 3g
>> line. When the link goes down, and some Emacs socket is still up, Emacs
>> freezes. This is quite annoying.
>
> Emacs should not freeze in such a case.  IIUC most cases where this
> happen are Elisp bugs (typically a missing with-local-quit or something
> like that), tho there are a few cases where it's a problem at the
> C level (IIRC, one such is during hostname lookup, but I don't know of
> any such case once the TCP connection is established).

But why then is quit inhibited at all?

Anyway, the freeze is quite easily reproducible. (as have been described in some
old bug reports)

- start gnus, make sure you read some nntp groups so nntp sockets are
  open
- make your network interface go away somehow (disconnecting 3g or
  something, but simply ifconfiging away should also work)
- stare in horror as your emacs freezes

This particular problem happens to me so often I have written a
workaround script like this:

,----
| #/bin/sh
| `lsof -n|grep emacs|grep nntp|sed "s/.*TCP\ \\([^:]*\\):.*->\\([^:].*\\):.*/  export a=\\1 export b=\\2/"`
| echo $a $b
| ifconfig eth2:1 $a
| ifconfig eth2:2 $b
| echo press enter when emacs is alive
| read
| ifconfig eth2:1 down
| ifconfig eth2:2 down
`----

since the socket is left even though the interface is gone, the script
ifconfigs new interfaces with information gleaned from the hanging
socket. After a while Emacs will live again, and the interfaces can be
removed.

>> I suppose that the hard blocking is there to prevent data loss or
>> whatever, but having to kill -9 Emacs results in worse dataloss.
>
> No, usually it's there because the Elisp coder is not aware of the risk
> (e.g. he doesn't realize his code will be run with inhibit-quit set,
> probably because he doesn't realize that this is set whenever we run
> process filters, process sentinels, post-command-hook, jit-lock,
> timers, and a handful other cases).
>
>
>         Stefan

-- 
Joakim Verona



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

* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
  2010-09-07 11:11       ` joakim
@ 2010-09-07 11:53         ` Lars Magne Ingebrigtsen
  2010-09-08  8:10         ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-07 11:53 UTC (permalink / raw)
  To: emacs-devel; +Cc: ding

joakim@verona.se writes:

> - start gnus, make sure you read some nntp groups so nntp sockets are
>   open
> - make your network interface go away somehow (disconnecting 3g or
>   something, but simply ifconfiging away should also work)
> - stare in horror as your emacs freezes

Does Emacs freeze immediately, or does it freeze the next time you try
to access the NNTP server?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
  2010-09-06 21:41 ` Blocking call to accept-process-output with quit inhibited!! [11 times] Stefan Monnier
  2010-09-06 21:48   ` Lars Magne Ingebrigtsen
  2010-09-07  7:08   ` joakim
@ 2010-09-07 11:54   ` Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-07 11:54 UTC (permalink / raw)
  To: emacs-devel; +Cc: ding

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> IOW, maybe there should be a (with-local-quit ...) somewhere so that the
> user can C-g out of such a state (or the call should have a timeout, or
> inhibit-quit should not be set, ...).

Is there a way to get a backtrace instead of the warning?  By looking at
the code, I can't tell where the message comes from.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
  2010-09-07 10:38     ` Stefan Monnier
  2010-09-07 11:11       ` joakim
@ 2010-09-07 18:33       ` Tom Tromey
  2010-09-08  8:12         ` Stefan Monnier
  1 sibling, 1 reply; 10+ messages in thread
From: Tom Tromey @ 2010-09-07 18:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: ding, joakim, emacs-devel

>>>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

[ emacs hanging ]
Stefan> (IIRC, one such is during hostname lookup, but I don't know of
Stefan> any such case once the TCP connection is established).

I've been bitten by this a number of times.

It seems to me that Emacs could either resolve names in a separate
thread (so the originating thread could handle other I/O and be
interruptable) or do the work in a subprocess.

Tom



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

* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
  2010-09-07 11:11       ` joakim
  2010-09-07 11:53         ` Lars Magne Ingebrigtsen
@ 2010-09-08  8:10         ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2010-09-08  8:10 UTC (permalink / raw)
  To: joakim; +Cc: ding, emacs-devel

>> Emacs should not freeze in such a case.  IIUC most cases where this
>> happen are Elisp bugs (typically a missing with-local-quit or something
>> like that), tho there are a few cases where it's a problem at the
>> C level (IIRC, one such is during hostname lookup, but I don't know of
>> any such case once the TCP connection is established).

> But why then is quit inhibited at all?

Because these are run asynchronously, so in most cases the user has no
idea that code is being executed at that point.  So if she hits C-g it's
likely to be for other reasons than to interrupt the async code, so by
default Emacs runs the async code to completion first and then processes
the C-g (you wouldn't want a C-g meant to abort a command to result in
a half-font-locked display, would you?).  I.e. if you want to execute
code that may last for a significant amount of time from one of those
places, you need with-local-quit (and you may want to make sure the user
knows that such code is being run).


        Stefan



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

* Re: Blocking call to accept-process-output with quit inhibited!! [11 times]
  2010-09-07 18:33       ` Tom Tromey
@ 2010-09-08  8:12         ` Stefan Monnier
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2010-09-08  8:12 UTC (permalink / raw)
  To: Tom Tromey; +Cc: ding, joakim, emacs-devel

> [ emacs hanging ]
Stefan> (IIRC, one such is during hostname lookup, but I don't know of
Stefan> any such case once the TCP connection is established).
> I've been bitten by this a number of times.
> It seems to me that Emacs could either resolve names in a separate
> thread (so the originating thread could handle other I/O and be
> interruptable) or do the work in a subprocess.

I'd tend to agree.  Patches welcome.  Maybe the concurrency extension
will resolve this problem eventually.


        Stefan



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

end of thread, other threads:[~2010-09-08  8:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m37hiya7na.fsf@quimbies.gnus.org>
2010-09-06 21:41 ` Blocking call to accept-process-output with quit inhibited!! [11 times] Stefan Monnier
2010-09-06 21:48   ` Lars Magne Ingebrigtsen
2010-09-07  7:08   ` joakim
2010-09-07 10:38     ` Stefan Monnier
2010-09-07 11:11       ` joakim
2010-09-07 11:53         ` Lars Magne Ingebrigtsen
2010-09-08  8:10         ` Stefan Monnier
2010-09-07 18:33       ` Tom Tromey
2010-09-08  8:12         ` Stefan Monnier
2010-09-07 11:54   ` 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).