Received: from maia.hub.org (maia-1.hub.org [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id D4AF26327E0 for ; Wed, 19 May 2010 00:37:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 98357-08 for ; Wed, 19 May 2010 03:36:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by mail.postgresql.org (Postfix) with SMTP id C1937632752 for ; Wed, 19 May 2010 00:36:53 -0300 (ADT) Received: (qmail 17796 invoked by uid 512); 19 May 2010 03:36:52 -0000 Received: from unknown (HELO ?127.0.0.1?) (100.0.32.252) by sd2.tpf-fw-c.co.jp with SMTP; 19 May 2010 03:36:52 -0000 Message-ID: <4BF35CC2.2010801@tpf.co.jp> Date: Wed, 19 May 2010 12:36:34 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: Barry Nicholson CC: pgsql-odbc@postgresql.org Subject: Re: FD_SETSIZE with large #s of files/ports in use References: <4BF32A8E.3030900@tpf.co.jp> In-Reply-To: <4BF32A8E.3030900@tpf.co.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.242 tagged_above=-10 required=5 tests=BAYES_00=-1.9, DNS_FROM_RFC_BOGUSMX=1.668, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/23 X-Sequence-Number: 10270 Hiroshi Inoue wrote: > Hi, > > Could you please try the attached patch? Oops it doesn't seem to work. Another way is to use poll() instead of select(). regards, Hiroshi Inoue > regards, > Hiroshi Inoue > > Barry Nicholson wrote: >> An interesting issue came up the other day. We are working with an >> application that opens a considerable number of files and tcp/udp >> ports (>3000). Unfortunately, that means that the odbc driver fails >> sometimes due to a corrupted stack. We eventually figured out what >> was causing the corrupted stack. >> The SOCK_wait_for_ready(SocketClass *sock, BOOL output, int >> retry_count) function inside socket.c calls select. Unfortunately, >> the socket file descriptor number can be quite large at this time. >> That means that the fd_set fds variable can misused. The fd_set >> variable type only allows 1024 file descriptors to be used by the >> calling program on many Linux versions. This can be changed by >> setting FD_SETSIZE or __FD_SETSIZE to a larger number. We have ran >> tests where we were able to change the __FD_SETSIZE value in >> /usr/src/...linuxversion../linux/include/linux/posix_types.h. The >> fix worked well. >> >> Unfortunately, this isn't a good solution because a software update to >> another linux version will invalidate our fix. We've tried various >> mechanisms to set FD_SETSIZE or __FD_SETSIZE in socket.c but with no >> luck. Has anyone else had this problem and came up with a good >> fix? Or is there a better solution? >> >> Barry Nicholson >> Niceng.com