[PATCH] Re: max connections not working like 2.0.7

James Sutherland jas88 at cam.ac.uk
Mon May 14 07:57:47 GMT 2001

On Sun, 13 May 2001, root wrote:

> > How about another tdb? :-)  Have a tdb that is indexed by service name,
> > and increment/decrement the number of connections when the connection is
> > claimed and yeilded. Whats more, we only need to do this when 'max
> > connections' is > 0, so performance isn't hit.  Finally, do a cleanup
> > occasionaly to walk the connections.tdb to check that the
> > maxconnections.tdb is correct.
> If you use a tdb for this then don't just use a counter, otherwise we
> will have no way of cleaning up when a smbd dies with a slot held.
> Either use a file with single byte fcntl locks (which are auto-removed
> by the OS) or if you wish to have a bit more info then use a tdb but
> with each record containing an array of PIDs that are using the
> service.
> hmmm, actually, you could use a straight counter and a tdb, and use
> TDB_CLEAR_IF_FIRST. Then cleanup can be done by stopping/starting
> smbd. Thats acceptable because a smbd dying without releasing a slot
> should be a very rare event (basically has to be a segv or similar).

Or use a straight counter, incrementing and decrementing as users
[dis]connect. This should never UNDERestimate the use count, which is
important. Then, if/when you reach the max connection limit, you do a more
expensive count of the EXACT number of connections.

> Alternatively, use the existing connections database and walk it at
> connection time to determine the usage count. Expensive, but only used
> if max_connections!=0

With a simple counter as well, you can avoid this step for every case
except when you already appear to have hit max_connections - which should
be very rare, I think?

"Our attitude with TCP/IP is, `Hey, we'll do it, but don't make a big
system, because we can't fix it if it breaks -- nobody can.'"

"TCP/IP is OK if you've got a little informal club, and it doesn't make
any difference if it takes a while to fix it."
		-- Ken Olson, in Digital News, 1988

More information about the samba-technical mailing list