From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: url-retrieve may cause hang Date: Tue, 17 Oct 2006 10:05:02 +0200 Message-ID: References: <878xjfydq3.fsf@freemail.hu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1161072811 15491 80.91.229.2 (17 Oct 2006 08:13:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 17 Oct 2006 08:13:31 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 17 10:13:30 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GZk4d-0001TE-0u for ged-emacs-devel@m.gmane.org; Tue, 17 Oct 2006 10:13:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GZk4c-0005nh-48 for ged-emacs-devel@m.gmane.org; Tue, 17 Oct 2006 04:13:18 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GZjxP-0003BX-G7 for emacs-devel@gnu.org; Tue, 17 Oct 2006 04:05:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GZjxL-0003A6-Mo for emacs-devel@gnu.org; Tue, 17 Oct 2006 04:05:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GZjxL-00039s-4o for emacs-devel@gnu.org; Tue, 17 Oct 2006 04:05:47 -0400 Original-Received: from [195.41.46.237] (helo=pfepc.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GZk6d-0008V5-O6 for emacs-devel@gnu.org; Tue, 17 Oct 2006 04:15:23 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepc.post.tele.dk (Postfix) with SMTP id 45DD78A006C for ; Tue, 17 Oct 2006 10:05:43 +0200 (CEST) Original-To: emacs-devel@gnu.org In-Reply-To: <878xjfydq3.fsf@freemail.hu> (Magnus Henoch's message of "Tue\, 17 Oct 2006 02\:42\:44 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:60813 Archived-At: Magnus Henoch writes: > David Reitter writes: > >> url-retrieve may cause Emacs to hang for around 3 minutes when the >> firewall is configured to delay packets. This is unwanted behavior, >> as url-retrieve claims to work asynchronously. >> >> Example: >> >> Configure firewall to delay (rather than deny) packets: >> >> sudo ipfw add 1 pipe 7 tcp from any to any 80 >> >> (url-retrieve "http://www.google.com" 'print) >> % or use url-http for this >> >> -> Hang until time-out (several minutes). > > The problem is in url-open-stream in url-gw.el. The URL library uses > open-network-stream, which blocks until the connection is established > (or times out, in this case). url-retrieve is indeed asynchronous > when the connection is established. > > It should use make-network-process with appropriate arguments, and set > up sentinels and such, which is the first thing I intend to do after > the release, as it might be tricky to get it right. Or should I > change my plan and do it now? I doubt it is very tricky to do. You should check with (featurep 'make-network-process '(:nowait t)) to see if non-blocking connect is possible, and fallback to the current blocking code if not. Try making the change -- then we can look at the patches and judge whether it is ok to install before the release (if it hasn't happened before). -- Kim F. Storm http://www.cua.dk