Subject: bug#22789: 25.1.50; In last master build https connections stop working

From: Eli Zaretskii <[email-masked]>
Date: Sat, 05 Mar 2016 15:24:23 +0200

> From: Lars Magne Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Sat, 05 Mar 2016 13:26:50 +0100
> 
> This is probably totally unrelated, but I saw a "hang" in Emacs for the
> first time in weeks.  shr was downloading an image over https, and Emacs
> became unresponsive.  strace showed the following:
> 
> [pid 12890] pselect6(39, [3 6 7 12 13 14 15 16 17 18 19 20 38], [], NULL, {0, 0}, {NULL, 8}) = 2 (in [18 19], left {0, 0})
> [pid 12890] pselect6(39, [3 6 7 12 13 14 15 16 17 18 19 20 38], [], NULL, {0, 0}, {NULL, 8}) = 2 (in [18 19], left {0, 0})
> [pid 12890] pselect6(39, [3 6 7 12 13 14 15 16 17 18 19 20 38], [], NULL, {0, 0}, {NULL, 8}) = 2 (in [18 19], left {0, 0})
> [pid 12890] pselect6(39, [3 6 7 12 13 14 15 16 17 18 19 20 38], [], NULL, {0, 0}, {NULL, 8}) = 2 (in [18 19], left {0, 0})
> [pid 12890] pselect6(39, [3 6 7 12 13 14 15 16 17 18 19 20 38], [], NULL, {0, 0}, {NULL, 8}) = 2 (in [18 19], left {0, 0})
> [pid 12890] pselect6(39, [3 6 7 12 13 14 15 16 17 18 19 20 38], [], NULL, {0, 0}, {NULL, 8}) = 2 (in [18 19], left {0, 0})
> [pid 12890] pselect6(39, [3 6 7 12 13 14 15 16 17 18 19 20 38], [], NULL, {0, 0}, {NULL, 8}) = 2 (in [18 19], left {0, 0})
> [pid 12890] pselect6(39, [3 6 7 12 13 14 15 16 17 18 19 20 38], [], NULL, {0, 0}, {NULL, 8}) = 2 (in [18 19], left {0, 0})
> [pid 12890] pselect6(39, [3 6 7 12 13 14 15 16 17 18 19 20 38], [], NULL, {0, 0}, {NULL, 8}) = 2 (in [18 19], left {0, 0})
> 
> This went on for perhaps 30 seconds?  (Hm.  Which is what I have
> `url-queue-timeout' set to...  Hm...) Then it stopped without
> downloading the image.

Hard to say anything intelligent without knowing what are descriptors
18 and 19.

> Now, the pselect6 call has a timeout of {0, 0}?  If I'm reading the man
> page right.
> 
> I think it's probably this code?
> 
>       /* If status of something has changed, and no input is
> 	 available, notify the user of the change right away.  After
> 	 this explicit check, we'll let the SIGCHLD handler zap
> 	 timeout to get our attention.  */
>       if (update_tick != process_tick)
> 	{
> 	  fd_set Atemp;
> 	  fd_set Ctemp;
> 
>           if (kbd_on_hold_p ())
>             FD_ZERO (&Atemp);
>           else
>             Atemp = input_wait_mask;
> 	  Ctemp = write_mask;
> 
> 	  timeout = make_timespec (0, 0);
> 	  if ((pselect (max (max_process_desc, max_input_desc) + 1,
> 			&Atemp,
> #ifdef NON_BLOCKING_CONNECT
> 			(num_pending_connects > 0 ? &Ctemp : NULL),
> #else
> 			NULL,
> #endif
> 			NULL, &timeout, NULL)
> 	       <= 0))
> 
> I'm not quite sure what it's trying to do...  Hm...

The comment above seems to explain what it does, no?