Skip to content

Commit

Permalink
Now warns if file descriptor limit is too small for native mode (#411)
Browse files Browse the repository at this point in the history
* Now warns if file descriptor limit is too low

* Requested changes for PR #411
  • Loading branch information
BGluth authored Jul 23, 2024
1 parent 2ba5b90 commit 0160f5f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions zero_bin/tools/prove_rpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ OUTPUT_TO_TERMINAL="${OUTPUT_TO_TERMINAL:-false}"
# Only generate proof by default
RUN_VERIFICATION="${RUN_VERIFICATION:-false}"

# Recommended soft file handle limit. Will warn if it is set lower.
RECOMMENDED_FILE_HANDLE_LIMIT=8192

mkdir -p $PROOF_OUTPUT_DIR

if [ $IGNORE_PREVIOUS_PROOFS ]; then
Expand Down Expand Up @@ -88,6 +91,19 @@ else
BLOCK_INTERVAL=$START_BLOCK..=$END_BLOCK
fi

# Print out a warning if the we're using `native` and our file descriptor limit is too low. Don't bother if we can't find `ulimit`.
if [ $(command -v ulimit) ] && [ $NODE_RPC_TYPE == "native" ]
then
file_desc_limit=$(ulimit -n)

if [[ $file_desc_limit -lt $RECOMMENDED_FILE_HANDLE_LIMIT ]]
then
echo "WARNING: Maximum file descriptor limit may be too low to run native mode (current: $file_desc_limit, Recommended: ${RECOMMENDED_FILE_HANDLE_LIMIT}).
Consider increasing it with:
ulimit -n ${RECOMMENDED_FILE_HANDLE_LIMIT}"
fi
fi

# If we set test_only flag, we'll generate a dummy
# proof. This is useful for quickly testing decoding and all of the
Expand Down

0 comments on commit 0160f5f

Please sign in to comment.