Subject Re: [IB-Architect] Interbase connection limit and Support related Problems
Author Jim Starkey
At 04:53 PM 7/5/00 +0200, Andre Mostert wrote:
>Interbase should be able to support more than 256 connections. The most
>disconcerting fact is that in the last two weeks we
>have emailed Ann Harrison and copied Paul Beach twice just to ascertain what
>progress has been made or when we can expect
>resolution to our problem. We have not enjoyed the curteousy of a reply. We
>realize that you are busy with ver 6 and probably
>with preparations for the conference. We however are sitting with 18 centres
>on our new app, and the balance awaiting
>resolution from Interbase and our software house.

I'll let Ann handle the business issues and take on the architectural

You're not going to like the answer, but the problem is Sun's. InterBase
can work around the Sun's problem, but only Sun has the ability to
fix it.

Here is the problem (from /usr/include/stdio.h):

/* @(#)stdio.h 1.16 89/12/29 SMI; from UCB 1.4 06/30/83 */

# ifndef FILE
#define BUFSIZ 1024
#define _SBFSIZ 8
extern struct _iobuf {
int _cnt;
unsigned char *_ptr;
unsigned char *_base;
int _bufsiz;
short _flag;
char _file; /* should be short */
} _iob[];

The field _file holds the FD (file descriptor). On Solaris (like virtually
all Unix systems), sockets and file descriptors come out of the same
number space, and are assigned sequentially, starting with 0. A
"char" field can only hold a number up to 255 (127 if you want to
be picky). If you start with stdin, stdout, and stderr tying down
0, 1, and 2, add a database file, that leaves a max of 252 connections
before the next file open overflows _file and the world ends.

The obvious workaround is to use a less-stupid set of buffered
IO functions, which the InterBase guys tried. A little painful, but
given a choice of open source file handling subsystems, completely
feasible. This was an imperfect solution as some other limit
(to the best of my knowledge, undiagnosed).

The bottom line is that exceeded in the inherant limitations of the
underlying operating systems is a tricky problem. Since anybody
using the standard Sun libraries is stuck with the 255 file/socket
limit, who knows what else is going to break.

Since this is an architectural and not a support list, I will just
point out that HPUX uses two bytes for the file descriptor and
Linux a full int.

Jim Starkey