]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set pool max default internally
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 May 2023 23:22:40 +0000 (19:22 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 May 2023 23:22:40 +0000 (19:22 -0400)
24 files changed:
doc/antora/modules/raddb/pages/mods-available/cache.adoc
doc/antora/modules/raddb/pages/mods-available/couchbase.adoc
doc/antora/modules/raddb/pages/mods-available/cui.adoc
doc/antora/modules/raddb/pages/mods-available/krb5.adoc
doc/antora/modules/raddb/pages/mods-available/ldap.adoc
doc/antora/modules/raddb/pages/mods-available/linelog.adoc
doc/antora/modules/raddb/pages/mods-available/mschap.adoc
doc/antora/modules/raddb/pages/mods-available/redis.adoc
doc/antora/modules/raddb/pages/mods-available/redis_ippool.adoc
doc/antora/modules/raddb/pages/mods-available/sql.adoc
doc/antora/modules/raddb/pages/mods-available/winbind.adoc
doc/antora/modules/raddb/pages/mods-available/yubikey.adoc
doc/antora/modules/raddb/pages/radclient.conf.adoc
raddb/mods-available/cache
raddb/mods-available/couchbase
raddb/mods-available/krb5
raddb/mods-available/linelog
raddb/mods-available/mschap
raddb/mods-available/redis
raddb/mods-available/redis_ippool
raddb/mods-available/sql
raddb/mods-available/winbind
raddb/mods-available/yubikey
src/lib/server/pool.c

index cabfd100ab97e8aeab039f74abeb0d164525d5dd..a5d7d16d2dca821aa78952b534d286213c892fdf 100644 (file)
@@ -324,9 +324,9 @@ cache {
 #      memcached {
 #              options = "--SERVER=localhost"
 #              pool {
-#                      start = ${thread[pool].num_workers}
-#                      min = ${thread[pool].num_workers}
-#                      max = ${thread[pool].num_workers}
+#                start = 0
+#                min = 0
+#                max =
 #                      spare = 1
 #                      uses = 0
 #                      lifetime = 0
@@ -339,9 +339,9 @@ cache {
 #              password = 'supersecret'
 #              database = 0
 #              pool {
-#                      start = ${thread[pool].num_workers}
-#                      min = ${thread[pool].num_workers}
-#                      max = ${thread[pool].num_workers}
+#                start = 0
+#                min = 0
+#                max =
 #                      spare = 1
 #                      uses = 0
 #                      lifetime = 0
index 1db9493b3d52c83d7d508ea14cd165a627057421..94c427161d5036a0f07b88bdd3deb6dcaacf77c2 100644 (file)
@@ -243,9 +243,9 @@ couchbase {
                }
        }
        pool {
-               start = ${thread[pool].num_workers}
-               min = ${thread[pool].num_workers}
-               max = ${thread[pool].num_workers}
+               start = 0
+               min = 0
+#              max =
                spare = 1
                uses = 0
                lifetime = 0
index e0e2b4881bfb659bf9ac2cbbf04fb6bdc7cbc04d..9ecf23912d5cc9c033f45ea4992016c7340102c6 100644 (file)
@@ -93,7 +93,7 @@ sql cuisql {
        pool {
                start = 5
                min = 4
-               max = 10
+#              max =
                spare = 3
                uses = 0
                lifetime = 0
index 2c45a6eb1ddacce4cf16f6f73c3a775e6ea70bd2..1fe4b1407d26f5127f9ee56403d4b7b4344f9b78 100644 (file)
@@ -134,9 +134,9 @@ krb5 {
        keytab = /path/to/keytab
        service_principal = name_of_principle
        pool {
-               start = ${thread[pool].num_workers}
-               min = ${thread[pool].num_workers}
-               max = ${thread[pool].num_workers}
+               start = 0
+               min = 0
+#              max =
                spare = 1
                uses = 0
                lifetime = 0
index e5c6d15bc09c0d4feb258f788f27d9d6b3d11559..ac8226390d930a7b5dcf8e972da760f2d225f62f 100644 (file)
@@ -849,9 +849,9 @@ ldap {
 #              tls_min_version = "1.2"
        }
        pool {
-               start = ${thread[pool].num_workers}
-               min = ${thread[pool].num_workers}
-               max = ${thread[pool].num_workers}
+               start = 0
+               min = 0
+#              max =
                spare = 1
                uses = 0
                retry_delay = 30
index 4deaf5b5d001b6f7dcab3c2de9bd1846e302df33..ef6a592a87254aff2ddcd1a085c6f9e0af357f93 100644 (file)
@@ -354,9 +354,9 @@ linelog {
                escape_filenames = no
        }
        pool {
-               start = ${thread[pool].num_workers}
-               min = ${thread[pool].num_workers}
-               max = ${thread[pool].num_workers}
+               start = 0
+               min = 0
+#              max =
                spare = 1
                uses = 0
                retry_delay = 30
index f255c8a9131016527ffccb94d46dda20bc06a1fd..fbf8f356a5c0b8e5117e67d9cf367212c9826a3e 100644 (file)
@@ -341,9 +341,9 @@ mschap {
 #              retry_with_normalised_username = no
        }
        pool {
-               start = ${thread[pool].num_workers}
-               min = ${thread[pool].num_workers}
-               max = ${thread[pool].num_workers}
+               start = 0
+               min = 0
+#              max =
                spare = 1
                uses = 0
                retry_delay = 30
index 641760e43fd1ae8527b4d1681a21258169f2be59..32ca313158b93e2fceb14b4a6b3665aced0aa9e1 100644 (file)
@@ -153,9 +153,9 @@ redis {
        port = 6379
 #      password = thisisreallysecretandhardtoguess
        pool {
-               start = ${thread[pool].num_workers}
-               min = ${thread[pool].num_workers}
-               max = ${thread[pool].num_workers}
+               start = 0
+               min = 0
+#              max =
                spare = 1
                uses = 0
                retry_delay = 30
index 60138f5627c5fe9a2c0b0043c1748bb3342b60c1..2f3237d3e32e35714f9e0231dfe6df7b78722b31 100644 (file)
@@ -157,8 +157,8 @@ redis_ippool {
                server = localhost
                pool {
                        start = 0
-                       min = ${thread[pool].num_workers}
-                       max = ${thread[pool].num_workers}
+                       min = 0
+#                      max =
                        spare = 1
                        uses = 0
                        lifetime = 0
index e99707b61a881a6bbdb58360f72e062104a7cd28..bfeed9af1a91459d144bf907bee1272a9cd01b0c 100644 (file)
@@ -316,9 +316,9 @@ sql {
 #      logfile = ${logdir}/sqllog.sql
 #      query_timeout = 5
        pool {
-               start = ${thread[pool].num_workers}
-               min = ${thread[pool].num_workers}
-               max = ${thread[pool].num_workers}
+               start = 0
+               min = 0
+#              max =
                spare = 1
                uses = 0
                retry_delay = 30
index ef245e1e43a9e3cf7a6c2f65df8ef7d462afa520..35ec04ee9761b1b921311ba3eb12063be91f862d 100644 (file)
@@ -164,9 +164,9 @@ winbind {
 #              attribute = "Winbind-Group"
        }
        pool {
-               start = ${thread[pool].num_workers}
-               min = ${thread[pool].num_workers}
-               max = ${thread[pool].num_workers}
+               start = 0
+               min = 0
+#              max =
                spare = 1
                uses = 0
                retry_delay = 30
index b86fae593f07876c3526d62f97e3f26222826c9f..d4053f06dfecdf4598918c3c0169bd0f85eda68f 100644 (file)
@@ -274,9 +274,9 @@ yubikey {
 #              client_id = 00000
 #              api_key = '000000000000000000000000'
                pool {
-                       start = ${thread[pool].num_workers}
-                       min = ${thread[pool].num_workers}
-                       max = ${thread[pool].num_workers}
+                 start = 0
+                 min = 0
+#                max =
                        uses = 0
                        retry_delay = 30
                        lifetime = 86400
index d3f5425e36aee4b864bdf84d0a3dab50a0b207b7..f036d165502e8d95b395602036b765c1f3d61b66 100644 (file)
@@ -38,9 +38,9 @@ radius {
                secret = $ENV{RADCLIENT_SECRET}
        }
        pool {
-               start = 1
-               min = 1
-               max = 1
+               start = 0
+               min = 0
+#              max =
        }
 }
 }
index cb30f6b244247750df9143c697a5b5c86990590f..bb669527465f9d13f8eb831cc753063c49de78d6 100644 (file)
@@ -77,8 +77,8 @@ cache {
                #
 #              pool {
 #                      start = 0
-#                      min = ${thread[pool].num_workers}
-#                      max = ${thread[pool].num_workers}
+#                      min = 0
+#                      max =
 #                      spare = 1
 #                      uses = 0
 #                      lifetime = 0
@@ -131,9 +131,9 @@ cache {
                #  pool:: Connection pool.
                #
 #              pool {
-#                      start = 0
-#                      min = ${thread[pool].num_workers}
-#                      max = ${thread[pool].num_workers}
+                       start = 0
+                       min = 0
+#                      max =
 #                      spare = 1
 #                      uses = 0
 #                      lifetime = 0
index 014a53ffd82744b7a06d4f41c6a918b3ad22e6fc..f9949a8918b412b19ad08f6fb8b07edc5866123d 100644 (file)
@@ -175,17 +175,18 @@ couchbase {
        pool {
                #
                #  start:: Connections to create during module instantiation.
-               #  If the server cannot create specified number of connections
-               #  during instantiation it will exit.
-               #  Set to `0` to allow the server to start without the couchbase
-               #  being available.
+               #
+               #  If the server cannot create specified number of
+               #  connections during instantiation it will exit.
+               #  Set to `0` to allow the server to start without the
+               #  external service being available.
                #
                start = 0
 
                #
                #  min:: Minimum number of connections to keep open.
                #
-               min = ${thread[pool].num_workers}
+               min = 0
 
                #
                #  max:: Maximum number of connections.
@@ -193,14 +194,17 @@ couchbase {
                #  If these connections are all in use and a new one
                #  is requested, the request will NOT get a connection.
                #
-               #  Setting `max` to LESS than the number of threads means
+               #  Setting `max` to *LESS* than the number of threads means
                #  that some threads may starve, and you will see errors
-               #  like '_No connections available and at max connection limit_'
+               #  like _No connections available and at max connection limit_.
                #
                #  Setting `max` to MORE than the number of threads means
                #  that there are more connections than necessary.
                #
-               max = ${thread[pool].num_workers}
+               #  If `max` is not specified, then it defaults to the number
+               #  of workers configured.
+               #
+#              max =
 
                #
                #  spare:: Spare connections to be left idle.
index 93dea30f4b0b0919849d2f3362e68858a7028cf2..9c8878d6aa455db8b25a95f314abea376d04b71b 100644 (file)
@@ -44,14 +44,14 @@ krb5 {
                #  If the server cannot create specified number of
                #  connections during instantiation it will exit.
                #  Set to `0` to allow the server to start without the
-               #  KDC being available.
+               #  external service being available.
                #
                start = 0
 
                #
                #  min:: Minimum number of connections to keep open.
                #
-               min = ${thread[pool].num_workers}
+               min = 0
 
                #
                #  max:: Maximum number of connections.
@@ -66,7 +66,10 @@ krb5 {
                #  Setting `max` to MORE than the number of threads means
                #  that there are more connections than necessary.
                #
-               max = ${thread[pool].num_workers}
+               #  If `max` is not specified, then it defaults to the number
+               #  of workers configured.
+               #
+#              max =
 
                #
                #  spare:: Spare connections to be left idle.
index 342c7b96afed198c4308f8f5ca1c82e8e1bd98da..4b2ed19247d41d38ad25795044e1362956ad6b47 100644 (file)
@@ -159,20 +159,19 @@ linelog {
        #
        pool {
                #
-               #  start::
+               #  start:: Connections to create during module instantiation.
                #
-               #  Connections to create during module instantiation.
                #  If the server cannot create specified number of
                #  connections during instantiation it will exit.
-               #  Set to 0 to allow the server to `start` without the
-               #  web service being available.
+               #  Set to `0` to allow the server to start without the
+               #  external service being available.
                #
                start = 0
 
                #
                #  min:: Minimum number of connections to keep open.
                #
-               min = ${thread[pool].num_workers}
+               min = 0
 
                #
                #  max:: Maximum number of connections.
@@ -180,14 +179,17 @@ linelog {
                #  If these connections are all in use and a new one
                #  is requested, the request will NOT get a connection.
                #
-               #  Setting `max` to LESS than the number of threads means
+               #  Setting `max` to *LESS* than the number of threads means
                #  that some threads may starve, and you will see errors
-               #  like 'No connections available and at `max` connection limit'
+               #  like _No connections available and at max connection limit_.
                #
                #  Setting `max` to MORE than the number of threads means
                #  that there are more connections than necessary.
                #
-               max = ${thread[pool].num_workers}
+               #  If `max` is not specified, then it defaults to the number
+               #  of workers configured.
+               #
+#              max =
 
                #
                #  spare:: Spare connections to be left idle.
index 1eb1af492e56a8a02f0c2fd0f6b82f55d38b9c40..99febfb9743cb0dce885b052671b154029b539aa 100644 (file)
@@ -201,22 +201,19 @@ mschap {
        #
        pool {
                #
-               #  start::
+               #  start:: Connections to create during module instantiation.
                #
-               #  Connections to create during module instantiation.
                #  If the server cannot create specified number of
                #  connections during instantiation it will exit.
-               #  Set to 0 to allow the server to start without the
-               #  winbind daemon being available.
+               #  Set to `0` to allow the server to start without the
+               #  external service being available.
                #
                start = 0
 
                #
-               #  min::
+               #  min:: Minimum number of connections to keep open.
                #
-               #  Minimum number of connections to keep open.
-               #
-               min = ${thread[pool].num_workers}
+               min = 0
 
                #
                #  max:: Maximum number of connections.
@@ -224,14 +221,17 @@ mschap {
                #  If these connections are all in use and a new one
                #  is requested, the request will NOT get a connection.
                #
-               #  Setting `max` to LESS than the number of threads means
+               #  Setting `max` to *LESS* than the number of threads means
                #  that some threads may starve, and you will see errors
-               #  like 'No connections available and at max connection limit'
+               #  like _No connections available and at max connection limit_.
                #
                #  Setting `max` to MORE than the number of threads means
                #  that there are more connections than necessary.
                #
-               max = ${thread[pool].num_workers}
+               #  If `max` is not specified, then it defaults to the number
+               #  of workers configured.
+               #
+#              max =
 
                #
                #  spare:: Spare connections to be left idle.
index 38d53f361fb17ef22ab7db90af4069b140f51c12..f8983c05cb15368cc12a5921daaa4e4b11170b68 100644 (file)
@@ -103,18 +103,18 @@ redis {
        pool {
                #
                #  start:: Connections to create during module instantiation.
-               #  If the server cannot create specified number of connections
-               #  during instantiation it will exit.
                #
-               #  Set to `0` to allow the server to start without the web service
-               #  being available.
+               #  If the server cannot create specified number of
+               #  connections during instantiation it will exit.
+               #  Set to `0` to allow the server to start without the
+               #  external service being available.
                #
                start = 0
 
                #
                #  min:: Minimum number of connections to keep open.
                #
-               min = ${thread[pool].num_workers}
+               min = 0
 
                #
                #  max:: Maximum number of connections.
@@ -122,14 +122,17 @@ redis {
                #  If these connections are all in use and a new one
                #  is requested, the request will NOT get a connection.
                #
-               #  Setting `max` to LESS than the number of threads means
+               #  Setting `max` to *LESS* than the number of threads means
                #  that some threads may starve, and you will see errors
-               #  like 'No connections available and at max connection limit'
+               #  like _No connections available and at max connection limit_.
                #
                #  Setting `max` to MORE than the number of threads means
                #  that there are more connections than necessary.
                #
-               max = ${thread[pool].num_workers}
+               #  If `max` is not specified, then it defaults to the number
+               #  of workers configured.
+               #
+#              max =
 
                #
                #  spare:: Spare connections to be left idle.
index 646e4925ea3768d44334846d88383db00b9644c8..5f55236e75b30d9acddf58b1f0a331f6cf0b266b 100644 (file)
@@ -156,8 +156,8 @@ redis_ippool {
 
                pool {
                        start = 0
-                       min = ${thread[pool].num_workers}
-                       max = ${thread[pool].num_workers}
+                       min = 0
+#                      max = 1
                        spare = 1
                        uses = 0
                        lifetime = 0
index 3fde3f1a27fd88b6bab0e35753aee9a20daab253..06290b188ec222b3d9fe39a36ed4d874ee7b49cd 100644 (file)
@@ -224,31 +224,35 @@ sql {
                #
                #  start:: Connections to create during module instantiation.
                #
-               #  If the server cannot create specified number of connections during instantiation
-               #  it will exit.
-               #
-               #  Set to `0` to allow the server to start without the database being available.
+               #  If the server cannot create specified number of
+               #  connections during instantiation it will exit.
+               #  Set to `0` to allow the server to start without the
+               #  external service being available.
                #
                start = 0
 
                #
                #  min:: Minimum number of connections to keep open.
                #
-               min = ${thread[pool].num_workers}
+               min = 0
 
                #
                #  max:: Maximum number of connections.
                #
-               #  If these connections are all in use and a new one is requested, the request
-               #  will NOT get a connection.
+               #  If these connections are all in use and a new one
+               #  is requested, the request will NOT get a connection.
+               #
+               #  Setting `max` to *LESS* than the number of threads means
+               #  that some threads may starve, and you will see errors
+               #  like _No connections available and at max connection limit_.
                #
-               #  Setting `max` to LESS than the number of threads means that some threads may starve,
-               #  and you will see errors like _No connections available and at max connection limit_.
+               #  Setting `max` to MORE than the number of threads means
+               #  that there are more connections than necessary.
                #
-               #  Setting `max` to MORE than the number of threads means that there are more
-               #  connections than necessary.
+               #  If `max` is not specified, then it defaults to the number
+               #  of workers configured.
                #
-               max = ${thread[pool].num_workers}
+#              max =
 
                #
                #  spare:: Spare connections to be left idle.
index f4adff658cab8cbe2b71050d77651c6a5393adb4..41b1e818dc751c40373ef940db3e9b90e42b128b 100644 (file)
@@ -81,21 +81,19 @@ winbind {
        #
        pool {
                #
-               #  start::
+               #  start:: Connections to create during module instantiation.
                #
-               #  Connections to create during module instantiation.
                #  If the server cannot create specified number of
                #  connections during instantiation it will exit.
-               #
                #  Set to `0` to allow the server to start without the
-               #  winbind daemon being available.
+               #  external service being available.
                #
                start = 0
 
                #
                #  min:: Minimum number of connections to keep open.
                #
-               min = ${thread[pool].num_workers}
+               min = 0
 
                #
                #  max:: Maximum number of connections.
@@ -103,14 +101,17 @@ winbind {
                #  If these connections are all in use and a new one
                #  is requested, the request will NOT get a connection.
                #
-               #  Setting `max` to LESS than the number of threads means
+               #  Setting `max` to *LESS* than the number of threads means
                #  that some threads may starve, and you will see errors
-               #  like 'No connections available and at max connection limit'
+               #  like _No connections available and at max connection limit_.
                #
                #  Setting `max` to MORE than the number of threads means
                #  that there are more connections than necessary.
                #
-               max = ${thread[pool].num_workers}
+               #  If `max` is not specified, then it defaults to the number
+               #  of workers configured.
+               #
+#              max =
 
                #
                #  spare:: Spare connections to be left idle.
index 50431889f266de429f7d2c217ec3702bde9e3984..aa7cba2766d05a989828ad70300b283a95051f63 100644 (file)
@@ -170,21 +170,19 @@ yubikey {
                #
                pool {
                        #
-                       #  start::
+                       #  start:: Connections to create during module instantiation.
                        #
-                       #  Connections to create during module instantiation.
                        #  If the server cannot create specified number of
                        #  connections during instantiation it will exit.
-                       #
                        #  Set to `0` to allow the server to start without the
-                       #  winbind daemon being available.
+                       #  external service being available.
                        #
                        start = 0
 
                        #
                        #  min:: Minimum number of connections to keep open.
                        #
-                       min = ${thread[pool].num_workers}
+                       min = 0
 
                        #
                        #  max:: Maximum number of connections.
@@ -192,15 +190,17 @@ yubikey {
                        #  If these connections are all in use and a new one
                        #  is requested, the request will NOT get a connection.
                        #
-                       #  Setting `max` to LESS than the number of threads means
+                       #  Setting `max` to *LESS* than the number of threads means
                        #  that some threads may starve, and you will see errors
-                       #  like 'No connections available and at max connection limit'
+                       #  like _No connections available and at max connection limit_.
                        #
                        #  Setting `max` to MORE than the number of threads means
                        #  that there are more connections than necessary.
                        #
-                       max = ${thread[pool].num_workers}
-
+                       #  If `max` is not specified, then it defaults to the number
+                       #  of workers configured.
+                       #
+#                      max =
                        #
                        #  uses:: Number of uses before the connection is closed.
                        #
index 26bcf6adfa645a520d10fdb8f8839fb03506dcc5..7800eafc14fedb0ac5c3ac45c27d8696739b39d3 100644 (file)
@@ -39,6 +39,7 @@ RCSID("$Id$")
 typedef struct fr_pool_connection_s fr_pool_connection_t;
 
 static int connection_check(fr_pool_t *pool, request_t *request);
+static int max_dflt(CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_token_t quote, CONF_PARSER const *rule);
 
 /** An individual connection within the connection pool
  *
@@ -150,7 +151,7 @@ struct fr_pool_s {
 static const CONF_PARSER pool_config[] = {
        { FR_CONF_OFFSET("start", FR_TYPE_UINT32, fr_pool_t, start), .dflt = "5" },
        { FR_CONF_OFFSET("min", FR_TYPE_UINT32, fr_pool_t, min), .dflt = "5" },
-       { FR_CONF_OFFSET("max", FR_TYPE_UINT32, fr_pool_t, max), .dflt = "10" },
+       { FR_CONF_OFFSET("max", FR_TYPE_UINT32, fr_pool_t, max), .dflt_func = max_dflt },
        { FR_CONF_OFFSET("max_pending", FR_TYPE_UINT32, fr_pool_t, max_pending), .dflt = "0" },
        { FR_CONF_OFFSET("spare", FR_TYPE_UINT32, fr_pool_t, spare), .dflt = "3" },
        { FR_CONF_OFFSET("uses", FR_TYPE_UINT64, fr_pool_t, max_uses), .dflt = "0" },
@@ -165,6 +166,17 @@ static const CONF_PARSER pool_config[] = {
        CONF_PARSER_TERMINATOR
 };
 
+static int max_dflt(CONF_PAIR **out, UNUSED void *parent, CONF_SECTION *cs, fr_token_t quote, CONF_PARSER const *rule)
+{
+       char            *strvalue;
+
+       strvalue = talloc_asprintf(NULL, "%u", main_config->max_workers);
+       *out = cf_pair_alloc(cs, rule->name, strvalue, T_OP_EQ, T_BARE_WORD, quote);
+       talloc_free(strvalue);
+
+       return 0;
+}
+
 /** Order connections by reserved most recently
  */
 static int8_t last_reserved_cmp(void const *one, void const *two)