Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now warns if file descriptor limit is too small for native mode #411

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=4096
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually recommend 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 -s ${RECOMMENDED_FILE_HANDLE_LIMIT}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't -s only updating the stack size, as opposed to ulimit -n which updates the maximum number of open file descriptors?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, good catch! Not sure how that got swapped with -s.

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
Loading