This bug is created as a clone of upstream ticket:
Follow on from #48384
Now that we have working ram and sanity checks, we need to make sure they work together properly.
Right now, as the server starts we are checking the backends in isolation.
Lets say we have 1GB of ram. We have two backends, that each request 768MB.
Both would pass the sanity check, as they check the free memory at the time, independent of each other. Then both start and over time would allocate up to 1.5GB potentially causing swap or worse OOM conditions.
Our backend sizing checks should check the sum of all backends and all caches together, before declaring "sane".
This will have to be done pre-backend init.
* Remove the "fuzzy" second backend check that doesn't really work. It's not concrete.
* Move the db sizing checks out from ldbm plugins.
* Expose a plugin function to return the cache sizings and values. We should also have backends expose their dn and entry cache sizes.
* Alter the server start up procedure such that:
load the plugins (but don't start the DB's / backend yet)
trigger each backend to "attempt" the autosizing procedure based on the admin's rules.
retrieve *all* the cache sizings
validate the sum of all caches
start the backends and dbs
stop the server with lots of big warnings, and the complete set of information related to memory and cache sizings.
For the verification, please see this comment and give insane config parameters and check the error logs.
1. Install Directory Server instance
2. Create one more backend via console
3. Stop the instance
4. Edit dse.ldif file. Change nsslapd-cachememsize attribute on both backends. Sum of the nsslapd-cachememsize values should be bigger then total RAM on the machine
5. Start the instance
6. Check logs
[01/Aug/2016:19:14:24.327625010 +0200] CRITICAL: It is highly likely your memory configuration of all backends will EXCEED your systems memory.
[01/Aug/2016:19:14:24.339033562 +0200] CRITICAL: In a future release this WILL prevent server start up. You MUST alter your configuration.
[01/Aug/2016:19:14:24.344020105 +0200] Total entry cache size: 282638208 B; dbcache size: 10000000 B; available memory size: 246763520 B;
[01/Aug/2016:19:14:24.348845854 +0200] This can be corrected by altering the values of nsslapd-dbcachesize, nsslapd-cachememsize and nsslapd-dncachememsize
Logs have appropriate messages. Marking as verified.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.