delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
Date: | Tue, 15 Jul 2008 19:11:07 +0200 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: write big buffer to connected socket, then close socket hangs cygwin |
Message-ID: | <20080715171107.GM24644@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <aa7d410c0807150835p529a94cflb43abb87919912 AT mail DOT gmail DOT com> |
MIME-Version: | 1.0 |
In-Reply-To: | <aa7d410c0807150835p529a94cflb43abb87919912@mail.gmail.com> |
User-Agent: | Mutt/1.5.16 (2007-06-09) |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
On Jul 15 17:35, kalle ko wrote: > Latest updated cygwin (just updated to make sure), Windows Vista SP1. > > This will hang cygwin 1.5.25-cr-0x5f1: > 1. Create a connected socket > 2. Send a big enough buffer (> 0x4238 bytes) > 3. Close the socket > > It will hang in the close() function. Only way is to kill it with > taskmanager or close the cygwin window. Source code is attached. Thanks for the testcase. There's nothing in Cygwin's socket code which would make it dependent on the buffer size given to the send() function. Your scenario triggers the auto-linger in Cygwin's socket close() function, which has been added many years ago to workaround a problem with WinSock on application exit. For some reason the linger doesn't timeout (which it should after about 4 minutes), as soon as the sent buffer is bigger than this weird 0x4238. Since Cygwin doesn't handle anything differently due to size, this looks like a WinSock problem we just never encountered. To fix this in your application, you should call shutdown(SHUT_WR) before calling close(). This seems to be fixed in the next Cygwin release 1.7 which doesn't linger in close anymore, but due to limited testing it's still not entirely clear if that's ok now. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |