X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 22 Nov 2010 14:17:29 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: ioctl() on socket fd's take 3 seconds on 1.7.7 Message-ID: <20101122131729.GT18309@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20101115162242 DOT GF17405 AT calimero DOT vinschen DOT de> <4CE8046F DOT 2090106 AT arcor DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4CE8046F.2090106@arcor.de> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Nov 20 18:25, Jason Curl wrote: > On 15/11/2010 17:22, Corinna Vinschen wrote: > >On Nov 9 09:20, Jason Curl wrote: > >> 166 65418 [main] ipcheck 5580 ioctl: fd 3, cmd 80087364 > >>--- Process 5580, exception C0000005 at 610C8C86 > > > >Crash in Cygwin, but the address doesn't help much, unfortunately. > > > >>Interestingly enough, the program works. That is, it finds all > >>interfaces and returns correct values (except interface names are > >>UUIDs instead of something more friendly like "eth0" that existed in > >>1.5.26). > >> > >>It will be a little later when I'm able to generate a working test case. > > > >T'would be nice. Please make it short and simple and, if possible, in > >plain C. > > I've generated a relatively simple test case that I can compile > using cygwin1-20101102.dll. Thank you. I can't reproduce any slowness, each ioctl takes only a couple of milliseconds. At least I could reproduce the exception when stracing the testcase and I've applied a matching patch to Cygwin. Can you retry with the next developer snapshot? Are the ioctl calls still slow? If so, I'm wondering if the GetAdaptersAddresses call is rather slow if a lot of interfaces exist. Every single ioctl in your application calls GetAdaptersAddresses twice, like this: bool get_adapters_addresses (PIP_ADAPTER_ADDRESSES *pa_ret, ULONG family) { DWORD ret, size = 0; PIP_ADAPTER_ADDRESSES pa0 = NULL; if (!pa_ret) return ERROR_BUFFER_OVERFLOW == GetAdaptersAddresses (family, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_INCLUDE_ALL_INTERFACES, NULL, NULL, &size); do { ret = GetAdaptersAddresses (family, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_INCLUDE_ALL_INTERFACES, NULL, pa0, &size); if (ret == ERROR_BUFFER_OVERFLOW && !(pa0 = (PIP_ADAPTER_ADDRESSES) realloc (pa0, size))) break; } while (ret == ERROR_BUFFER_OVERFLOW); if (ret != ERROR_SUCCESS) { if (pa0) free (pa0); *pa_ret = NULL; return false; } *pa_ret = pa0; return true; } Can you test how long this call takes in your scenario, and if it might be the culprit? Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple