Closed EdsonLuisVieira closed 1 year ago
The default max key size is 511, document of LMDB(https://lmdb.readthedocs.io/en/release/) says:
By default record keys are limited to 511 bytes in length, however this can be adjusted by rebuilding the library. The compile-time key length can be queried via [Environment.max_key_size()](https://lmdb.readthedocs.io/en/release/#lmdb.Environment.max_key_size).
@chronolaw will Kong increase the default value in next versions? Or 511 is the new “hard limit” for pre-built release images?
We will have an internal discussion about it. Thanks for your report again.
Ticket: KAG-560.
Are there any updates? I'm willing to try to solve this problem, I just want to confirm: does it make sense to allow max key size over 512? In what scenario would a key size larger than 512 be required? @EdsonLuisVieira
I can guess some random key generation scenarios to prevent key conflicts, but I think the default key size (512) is sufficient in this scenario.
@sabertobihwy In my opinion, an API Key with max of 511 chars is pretty reasonable. The only thing is: I can not upgrade Kong "as is" (without changing this secret in all my clients and reconfiguring Kong), also, it is not documented;
What also made me uncomfortable was the fact: the length of the value
of the attribute key
is bigger than 511 chars... so, could I not use strings bigger than 511 chars in other places, such as configs for "post function" plugin?! - The fact is I can; It only complains with API Keys.
hello @sabertobihwy, in our case we are upgrading from version 2.x to 3.x and we can't make the update transparently("not counting deprecations and plugin updates"), but this kind of problem turns on a certain impediment, our main concern is that the size in the yaml is for a value but the error presents it as a key, so we are concerned that this cannot affect other values in custom plugins or definitions of routes and services.
Another point that is relevant is that the command kong config parse
show the yaml as valid, so we only get the error when trying to load the new configuration in kong
This will be fixed in the lmdb library: https://github.com/Kong/lua-resty-lmdb/pull/27
Is there an existing issue for this?
Kong version 3.1.1
kong 3.1.1
Current Behavior
we are upgrading Kong from 2.x to Kong 3.x, and we are facing a blocking bug :cry: We use Kong Databaseless, and with the new LMDB mechanisms from Kong 3.x, our configurations are not loading.
In the tests in declarative config file the length of a consumer's API Key is causing it (but other places may also have the same problem)
When the value has more than 511 characters Kong starts the process, but with empty configurations, also Kong reports: 2023/02/02 14:21:35 [crit] 1129#0: 8 [lua] init.lua:697: init_worker(): worker initialization error: failed to load declarative config file: MDB_BAD_VALSIZE: Unsupported size of key/DB name/data, or wrong DUPFIXED size; this node must be restarted, context: init_worker_by_lua
Expected Behavior
kong in version 3.1.1 can load declarative configuration without errors
Steps To Reproduce
consumers:
services:
routes:
2023/02/02 16:40:15 [error] 1127#0: *889 [kong] config.lua:124 failed loading declarative config into cache: MDB_BAD_VALSIZE: Unsupported size of key/DB name/data, or wrong DUPFIXED size, client: 172.17.0.1, server: kong_admin, request: "POST /config HTTP/1.1", host: "localhost:8001"