From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#22789: 25.1.50; In last master build https connections stop working Date: Wed, 02 Mar 2016 18:03:57 +0000 Message-ID: <87d1rcrc36.fsf@gnus.org> References: <864mcyo14y.fsf@Lenovo-PC.i-did-not-set--mail-host-address--so-tickle-me> <87d1rmxl65.fsf@gnus.org> <86povm6qeu.wl-j_l_domenech@yahoo.com> <83k2lugeym.fsf@gnu.org> <871t81wtyt.fsf@gnus.org> <87r3g1veqc.fsf@gnus.org> <86si0euizj.fsf@realize.ch> <871t7xhj7t.fsf@gnus.org> <86oab1vjm9.fsf@realize.ch> <86d1rhpvcq.fsf@realize.ch> <834mctbitq.fsf@gnu.org> <868u25p3m2.fsf@realize.ch> <83io18ahya.fsf@gnu.org> <86y4a3on6f.fsf@realize.ch> <87oaazg7fv.fsf@gnus.org> <86twkro0vr.fsf@realize.ch> <87mvqjgqqg.fsf@gnus.org> <86k2lnnlwy.fsf@realize.ch> <831t7u9826.fsf@gnu.org> <87vb56vkti.fsf@gnus.org> <83ziui6w1s.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1456941925 6630 80.91.229.3 (2 Mar 2016 18:05:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Mar 2016 18:05:25 +0000 (UTC) Cc: j_l_domenech@yahoo.com, a.s@realize.ch, 22789@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 02 19:05:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1abB95-0007Up-C2 for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Mar 2016 19:05:11 +0100 Original-Received: from localhost ([::1]:58135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abB94-0005HY-T0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Mar 2016 13:05:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abB90-0005F6-Ji for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 13:05:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abB8x-0002kX-C7 for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 13:05:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abB8x-0002kT-7x for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 13:05:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1abB8x-0003Kn-2F for bug-gnu-emacs@gnu.org; Wed, 02 Mar 2016 13:05:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Mar 2016 18:05:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22789-submit@debbugs.gnu.org id=B22789.145694188212771 (code B ref 22789); Wed, 02 Mar 2016 18:05:03 +0000 Original-Received: (at 22789) by debbugs.gnu.org; 2 Mar 2016 18:04:42 +0000 Original-Received: from localhost ([127.0.0.1]:58058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1abB8b-0003Jv-SY for submit@debbugs.gnu.org; Wed, 02 Mar 2016 13:04:42 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:53976) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1abB8a-0003Jm-K2 for 22789@debbugs.gnu.org; Wed, 02 Mar 2016 13:04:41 -0500 Original-Received: from [31.55.6.3] (helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1abB7v-0001ZW-3J; Wed, 02 Mar 2016 19:03:59 +0100 In-Reply-To: <83ziui6w1s.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 01 Mar 2016 17:46:07 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1abB7v-0001ZW-3J MailScanner-NULL-Check: 1457546639.28349@NMtYosmPNbu+73qErSi2RA X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:114299 Archived-At: Eli Zaretskii writes: > So what you can do instead of launching a timer is this: as long as > some process waits for some sync stuff to complete, reduce the timeout > with which we call 'pselect' to some reasonably small value, like half > a second or maybe 0.25 sec. This will ensure the loop doesn't stop as > long as we wait for at least one such connection. (This will need a > simple logic to not exit the loop too early; see the variable > timeout_reduced_for_timers for a similar logic we employ already for > timers.) Aha! With the following (for debugging purposes only) patch, it looks like I'm getting progress on my https connections even if I don't have a blinking cursor. (I chose 50ms as my timeout, if I counted my zeroes correctly...) Were you thinking about something along these lines? If so, I can clean the patch up... diff --git a/src/process.c b/src/process.c index 85a4885..5376492 100644 --- a/src/process.c +++ b/src/process.c @@ -4870,6 +4870,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, struct timespec got_output_end_time = invalid_timespec (); enum { MINIMUM = -1, TIMEOUT, INFINITY } wait; int got_some_output = -1; + bool retry_for_async; ptrdiff_t count = SPECPDL_INDEX (); /* Close to the current time if known, an invalid timespec otherwise. */ @@ -4922,6 +4923,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, Lisp_Object process_list_head, aproc; struct Lisp_Process *p; + retry_for_async = false; FOR_EACH_PROCESS(process_list_head, aproc) { p = XPROCESS (aproc); @@ -4935,6 +4937,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, Lisp_Object ip_addresses = check_for_dns (aproc); if (!NILP (ip_addresses) && !EQ (ip_addresses, Qt)) connect_network_socket (aproc, ip_addresses); + else + retry_for_async = true; } #endif #ifdef HAVE_GNUTLS @@ -4950,12 +4954,16 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, gnutls_verify_boot (aproc, Qnil); finish_after_tls_connection (aproc); } - else if (p->gnutls_handshakes_tried - > GNUTLS_EMACS_HANDSHAKES_LIMIT) + else { - deactivate_process (aproc); - pset_status (p, list2 (Qfailed, - build_string ("TLS negotiation failed"))); + retry_for_async = true; + if (p->gnutls_handshakes_tried + > GNUTLS_EMACS_HANDSHAKES_LIMIT) + { + deactivate_process (aproc); + pset_status (p, list2 (Qfailed, + build_string ("TLS negotiation failed"))); + } } } #endif @@ -5044,6 +5052,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, Ctemp = write_mask; timeout = make_timespec (0, 0); + printf("Timeout is %lu\n", timeout.tv_sec); if ((pselect (max (max_process_desc, max_input_desc) + 1, &Atemp, #ifdef NON_BLOCKING_CONNECT @@ -5222,6 +5231,15 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, if (timeout.tv_sec > 0 || timeout.tv_nsec > 0) now = invalid_timespec (); + if (retry_for_async + && (timeout.tv_sec > 0 || timeout.tv_nsec > 50000000)) + { + timeout.tv_sec = 0; + timeout.tv_nsec = 50000000; + } + + printf("Here timeout is %lu/%lu\n", timeout.tv_sec, timeout.tv_nsec); + #if defined (HAVE_NS) nfds = ns_select #elif defined (HAVE_GLIB) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no