all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* cosmic timeout
@ 2013-11-02 23:20 Jarek Czekalski
  2013-11-03  3:44 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Jarek Czekalski @ 2013-11-02 23:20 UTC (permalink / raw)
  To: emacs-devel

Is anyone able to give a reasonable explanation to this part of 
process.c (repeated 2 times):

114031       eggert@ |       timeout = make_timespec (100000, 0);

This is 100000 seconds, more than a day. I guess that freezes my Emacs 
when I play with a vertical scroll bar.

Jarek




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

* Re: cosmic timeout
  2013-11-02 23:20 cosmic timeout Jarek Czekalski
@ 2013-11-03  3:44 ` Eli Zaretskii
  2013-11-03  7:42   ` Jarek Czekalski
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2013-11-03  3:44 UTC (permalink / raw)
  To: Jarek Czekalski; +Cc: emacs-devel

> Date: Sun, 03 Nov 2013 00:20:15 +0100
> From: Jarek Czekalski <jarekczek@poczta.onet.pl>
> 
> Is anyone able to give a reasonable explanation to this part of 
> process.c (repeated 2 times):
> 
> 114031       eggert@ |       timeout = make_timespec (100000, 0);
> 
> This is 100000 seconds, more than a day.

This is "infinite wait", yes.  See the commentary to that function:

   NSECS is:
     an additional duration to wait, measured in nanoseconds
     If TIME_LIMIT is zero, then:
       If NSECS == 0, there is no limit.  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
       If NSECS > 0, the timeout consists of NSECS only.
       If NSECS < 0, gobble data immediately, as if TIME_LIMIT were negative.

> I guess that freezes my Emacs when I play with a vertical scroll
> bar.

It shouldn't: scroll-bar input counts as input, and should stop the
wait.  Some other factor is at work here.

Perhaps you could post your findings, and let others suggest ideas
for further debugging.



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

* Re: cosmic timeout
  2013-11-03  3:44 ` Eli Zaretskii
@ 2013-11-03  7:42   ` Jarek Czekalski
  2013-11-03  8:50     ` Stephen J. Turnbull
  0 siblings, 1 reply; 5+ messages in thread
From: Jarek Czekalski @ 2013-11-03  7:42 UTC (permalink / raw)
  To: emacs-devel

W dniu 11/03/2013 04:44 AM, Eli Zaretskii pisze:
> This is "infinite wait", yes.  See the commentary to that function:

My bad. Indeed it works according to the docs.

>> I guess that freezes my Emacs when I play with a vertical scroll
>> bar.
> It shouldn't: scroll-bar input counts as input, and should stop the
> wait.  Some other factor is at work here.
>
> Perhaps you could post your findings, and let others suggest ideas
> for further debugging.

Findings are that gtk gets stuck in all threads waiting on poll-like 
functions. I wonder why do *we* want to wait infinitely. Or the other 
way: if there is a bug in glib, do we want to fix it or workaround it.

I will investigate, why the infinite wait is demanded by Emacs, but if 
you like to answer the above question in advance, that helps.

I use unstable Debian. When I change the infinite wait to something like 
0.1 sec, it seems to stop freezing. And undocumented function 
g_main_query_context returns sometimes 0 and -1. Maybe in this case our 
xgselect should not pass the infinite timeout to its further gnome calls.

Thanks,
Jarek




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

* Re: cosmic timeout
  2013-11-03  7:42   ` Jarek Czekalski
@ 2013-11-03  8:50     ` Stephen J. Turnbull
  2013-11-03 10:01       ` Jarek Czekalski
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen J. Turnbull @ 2013-11-03  8:50 UTC (permalink / raw)
  To: Jarek Czekalski; +Cc: emacs-devel

Jarek Czekalski writes:

 > Findings are that gtk gets stuck in all threads waiting on poll-like 
 > functions.

If you mean the OS poll() function, X.org has historically had a bug
(in true X.org fashion, they say it's not their job to keep promises
if other software might be buggy) where _XtWaitForSomething() can
infloop in non-blocking mode.  I forget whether this shows up with
poll() or with select().

https://bugs.freedesktop.org/show_bug.cgi?id=20048

for more info.

 > I will investigate, why the infinite wait is demanded by Emacs, but if 
 > you like to answer the above question in advance, that helps.

It's not an infinite wait.  It's Emacs blocking on *any* input.  The
function should return as soon as there's input.

I would check for a bug like the above in GTK.





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

* Re: cosmic timeout
  2013-11-03  8:50     ` Stephen J. Turnbull
@ 2013-11-03 10:01       ` Jarek Czekalski
  0 siblings, 0 replies; 5+ messages in thread
From: Jarek Czekalski @ 2013-11-03 10:01 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: emacs-devel

W dniu 11/03/2013 09:50 AM, Stephen J. Turnbull pisze:
>   > I will investigate, why the infinite wait is demanded by Emacs, but if
>   > you like to answer the above question in advance, that helps.
>
> It's not an infinite wait.  It's Emacs blocking on *any* input.  The
> function should return as soon as there's input.

I identified this infinite waiting for input:

         key = read_char (prevent_redisplay ? -2 : NILP (prompt),
                      current_binding, last_nonmenu_event,
                              &used_mouse_menu, NULL);

where NULL means no timeout. keyboard.c 9072

I don't call it an error, but just to make a point of a cosmic timeout. 
It originates from here.

The clue of the problem is different, because even when timeout is set 
to a number of 30 seconds, still wait_reading_process_output gets 
blocked until timeout expires.

I will dig more into it and definitely finish it in some way, perhaps 
reporting a bug in something.

Jarek




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

end of thread, other threads:[~2013-11-03 10:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-02 23:20 cosmic timeout Jarek Czekalski
2013-11-03  3:44 ` Eli Zaretskii
2013-11-03  7:42   ` Jarek Czekalski
2013-11-03  8:50     ` Stephen J. Turnbull
2013-11-03 10:01       ` Jarek Czekalski

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.