You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by is...@apache.org on 2023/09/29 17:31:13 UTC
[solr] branch branch_9x updated: SOLR-16644: Fixing the entropy warning threshold using scaling based on poolsize (closes #1842)
This is an automated email from the ASF dual-hosted git repository.
ishan pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 4bae5ecf454 SOLR-16644: Fixing the entropy warning threshold using scaling based on poolsize (closes #1842)
4bae5ecf454 is described below
commit 4bae5ecf45435b451340b1e7bbc7c867243dc109
Author: Ishan Chattopadhyaya <is...@apache.org>
AuthorDate: Fri Sep 29 23:00:53 2023 +0530
SOLR-16644: Fixing the entropy warning threshold using scaling based on poolsize (closes #1842)
---
solr/CHANGES.txt | 2 ++
solr/bin/solr | 24 +++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 573290f2ce7..1c313fdc8b2 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -163,6 +163,8 @@ Bug Fixes
* SOLR-16992: Non-reproducible StreamingTest failures -- suggests CloudSolrStream concurency race condition (Alex Deparvu, hossman)
+* SOLR-16644: Fixing the entropy warning threshold using scaling based on poolsize (Raghavan Muthuregunathan)
+
Dependency Upgrades
---------------------
diff --git a/solr/bin/solr b/solr/bin/solr
index cba332d2ce2..d95c61d1b46 100644
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -2391,12 +2391,26 @@ function start_solr() {
-jar start.jar "${SOLR_JETTY_CONFIG[@]}" $SOLR_JETTY_ADDL_CONFIG \
1>"$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log" 2>&1 & echo $! > "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
- # check if /proc/sys/kernel/random/entropy_avail exists then check output of cat /proc/sys/kernel/random/entropy_avail to see if less than 300
- if [[ -f /proc/sys/kernel/random/entropy_avail ]] && (( $(cat /proc/sys/kernel/random/entropy_avail) < 300)); then
- echo "Warning: Available entropy is low. As a result, use of the UUIDField, SSL, or any other features that require"
- echo "RNG might not work properly. To check for the amount of available entropy, use 'cat /proc/sys/kernel/random/entropy_avail'."
- echo ""
+ # Get the current entropy available
+ entropy_avail=$(cat /proc/sys/kernel/random/entropy_avail)
+
+ # Get the pool size
+ pool_size=$(cat /proc/sys/kernel/random/poolsize)
+
+ # Check if entropy is available and pool size is non-zero
+ if [[ $entropy_avail -gt 0 && $pool_size -ne 0 ]]; then
+ # Compute the ratio of entropy available to pool size
+ ratio=$(awk -v ea="$entropy_avail" -v ps="$pool_size" 'BEGIN {print (ea/ps)*100}')
+
+ # Check if the ratio is less than 25%
+ if (( $(echo "$ratio < 25" | bc -l) )); then
+ echo "Warning: Available entropy is low. As a result, use of the UUIDField, SSL, or any other features that require"
+ echo "RNG might not work properly. To check for the amount of available entropy, use 'cat /proc/sys/kernel/random/entropy_avail'."
+ fi
+ else
+ echo "Error: Either no entropy is available or the pool size is zero."
fi
+
# no lsof on cygwin though
if lsof -v 2>&1 | grep -q revision; then
echo -n "Waiting up to $SOLR_START_WAIT seconds to see Solr running on port $SOLR_PORT"