Received: from maia.hub.org (maia-1.hub.org [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 5231E632F8A for ; Tue, 18 May 2010 17:01:08 -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 87737-05 for ; Tue, 18 May 2010 20:00:55 +0000 (UTC) X-Greylist: delayed 00:21:14.083757 by SQLgrey-1.7.6 Received: from gs18.inmotionhosting.com (gs18.inmotionhosting.com [74.124.218.200]) by mail.postgresql.org (Postfix) with ESMTP id 54FB76328D4 for ; Tue, 18 May 2010 17:00:59 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=secure18.inmotionhosting.com) by gs18.inmotionhosting.com with esmtpa (Exim 4.69) (envelope-from ) id 1OESdB-0006A0-S0 for pgsql-odbc@postgresql.org; Tue, 18 May 2010 12:39:09 -0700 MIME-Version: 1.0 Date: Tue, 18 May 2010 12:39:09 -0700 From: Barry Nicholson To: Subject: =?UTF-8?Q?FD=5FSETSIZE=20with=20large=20=23s=20of=20files/ports=20in=20us?= =?UTF-8?Q?e?= Organization: Niceng Message-ID: X-Sender: b.nicholson@niceng.com User-Agent: RoundCube Webmail/0.3.1 Content-Type: multipart/alternative; boundary="=_8e0051069f5bc30063eebc5dfbdf1fc4" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gs18.inmotionhosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - niceng.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201005/21 X-Sequence-Number: 10268 --=_8e0051069f5bc30063eebc5dfbdf1fc4 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 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 --=_8e0051069f5bc30063eebc5dfbdf1fc4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

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 (&= gt;3000).   Unfortunately, that means that the odbc driver fails = sometimes due to a corrupted stack.  We eventually figured out what wa= s causing the corrupted stack. 

The SOCK_wait_for_ready(= SocketClass *sock, BOOL output, int retry_count) function inside socket.c c= alls 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 descri= ptors 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 numb= er.   We have ran tests where we were able to change the __FD_SET= SIZE value in /usr/src/...linuxversion../linux/include/linux/posix_types.h= =2E   The fix worked well.

Unfortunately, this isn't= a good solution because a software update to another linux version will in= validate our fix.   We've tried various mechanisms to set FD_SETS= IZE or __FD_SETSIZE in socket.c but with no luck.   Has anyone el= se had this problem and came up with a good fix?   Or is there a = better solution?

Barry Nicholson
Niceng.com

--=_8e0051069f5bc30063eebc5dfbdf1fc4--