X-Spam-Check-By: sourceware.org Message-ID: <438AF263.DC178000@dessent.net> Date: Mon, 28 Nov 2005 04:04:51 -0800 From: Brian Dessent MIME-Version: 1.0 To: Soh Kam Yung CC: cygwin AT cygwin DOT com Subject: Re: Query: issue with cygwin-curl 7.15.0 - cannot close some connections References: <3ace93110511280052i67bd114cn6664a26864a24eaa AT mail DOT gmail DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Soh Kam Yung wrote: > Brian, Please send all questions about using the Cygwin curl packages to the cygwin (at) cygwin.com mailing list, which I follow. Please do not email me personally. > I have been using curl under cygwin and noticed an issue with closing > of connections with some websites and ftp sites. > ... > > curl --verbose ftp://ftp.kernel.org/ > ... > < 150 Here comes the directory listing. > drwxrwx--- 2 536 528 4096 May 21 2001 for_mirrors_only > drwx------ 2 0 0 16384 Oct 02 09:20 lost+found > drwxrwsr-x 9 536 536 4096 Sep 26 22:48 pub > lrwxrwxrwx 1 0 0 1 Oct 03 04:41 usr -> . > lrwxrwxrwx 1 0 0 10 Oct 03 04:41 welcome.msg -> > pub/README > > At this point, curl waits and waits and doesn't close the connection > > I have noticed this happening with ftp sites and some websites that > provide chunked data after doing a login using data provided by curl. > > Do you have any ideas what might be happening? I was able to reproduce this. What's happening is that curl goes into an endless loop where it calls poll() repeatedly, thinking that there is more data to read, trying to read it, finding nothing, and repeating -- you can observe the curl process taking all the CPU during the hang. The reason that it apparently did not realize that the connection had been terminated was that the Cygwin poll() was returning 1 with the POLLHUP bit set in 'revents'. But curl was not aware of this bit and only looked for POLLIN, so it got confused, which caused the infinite loop. This was changed several weeks ago in Cygwin by this: which means that if you use a recent snapshot (and presumably the forthcoming 1.5.19 release) you should not experience the problem. I'm debating whether it would be a good idea to put out an updated curl that checks for POLLHUP to get things working again with older cygwins. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/