From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10630 invoked by alias); 2 Sep 2009 14:28:26 -0000 Received: (qmail 10618 invoked by uid 22791); 2 Sep 2009 14:28:25 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_20 X-Spam-Check-By: sourceware.org Received: from bender.grapevine.net.au (HELO bender.grapevine.net.au) (203.129.32.139) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Sep 2009 14:28:19 +0000 Received: from localhost (localhost [127.0.0.1]) by bender.grapevine.net.au (Postfix) with ESMTP id F4134210252; Thu, 3 Sep 2009 00:28:15 +1000 (EST) Received: from bender.grapevine.net.au ([127.0.0.1]) by localhost (bender.grapevine.net.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B9AZiUe9RXa1; Thu, 3 Sep 2009 00:28:15 +1000 (EST) Received: from [10.1.1.16] (ppp-248.207.127.121.grapevine.net.au [121.127.207.248]) (Authenticated sender: Ross.Johnson@homemail.com.au) by bender.grapevine.net.au (Postfix) with ESMTP id A33A0210234; Thu, 3 Sep 2009 00:28:15 +1000 (EST) Message-ID: <4A9E80FD.3040409@homemail.com.au> Date: Wed, 02 Sep 2009 14:28:00 -0000 From: Ross Johnson User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Laura Arhire CC: pthreads-win32@sourceware.org Subject: Re: strange pthread_create cap References: <4A9E4D93.5050407@endion-software.com> In-Reply-To: <4A9E4D93.5050407@endion-software.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org X-SW-Source: 2009/txt/msg00041.txt.bz2 Hi Laura, Pthread_create can return EAGAIN for several reasons, all to do with lack of resources, such as memory allocation (unlikely), or failing to start the underlying Windows native thread, e.g. due to a lack of resources there as well. I don't know Windows well enough but I'm wondering if your listening server sockets are really closing down, or perhaps just not quickly enough. What happens if you add a short delay between creating threads, i.e. opening new sockets? Also, are you testing on a Windows Server or Windows Workstation? I ask because, IIRC and if my information is not out-of-date, workstations have a limit (10) on the number of sockets that can be listening at the same time. Ross Laura Arhire wrote: > Hello > > I'm having some trouble with pthreads-win and sockets, wondering if > anyone can help. I have a test setup with a loop which iterates a > number of times. Inside the loop, I create a thread on which I run an > SSL server socket. After the thread is created, I connect an SSL > Client socket to the server socket, then disconnect it, disconnect the > server socket, and issue a pthread_join. > > Using this setup (one thread created with pthread_create at any time), > I cannot create anymore threads after 10-15 such iterations (in rare > cases - say if I run a 200-iteration loop, I might be able to create > threads again once I reach iteration 50 or so). I believe this to be > an issue with my SSL client socket implementation, because everything > works well if I don't connect a client socket during the iteration. It > also works well if I use a non-SSL server/client socket. > > However, I thought I'd ask here: is there any reason why > pthread_create would return EAGAIN in such a setup? The handle count > varies very slightly during the iterations but does not increase over > the run time. The memory does increase due to my test setup, but at > the maximum peak it is no where near close to using up all system > resources. > > Can it be some sort of problem with the release of the socket (win > sockets are not guaranteed to be released as soon as closesocket > returns) ? > > Thank you in advance, > Laura