-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Enhancement] The FE&BE&CN startup script automatically detects that the startup is successful #48793
base: main
Are you sure you want to change the base?
Conversation
…successfully started
echo "The startup time is more than $timeout seconds, the $process_name process may not start successfully!" | ||
else | ||
echo "This node does not have the curl command, please manually check whether the $process_name process is successfully started" | ||
fi | ||
else | ||
exec $LIMIT $JAVA $final_java_opt com.starrocks.StarRocksFE ${HELPER} ${HOST_TYPE} "$@" </dev/null | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most risky bug in this code is:
Potential race condition causing premature script exit.
You can modify the code like this:
# StarRocksFE java process will write its process id into $pidfile
if [ ${RUN_DAEMON} -eq 1 ]; then
echo "The $process_name process is starting!"
nohup $LIMIT $JAVA $final_java_opt com.starrocks.StarRocksFE ${HELPER} ${HOST_TYPE} "$@" &> /dev/null &
pid=$!
if command -v curl &>/dev/null; then
timeout=30
end_time=$((SECONDS + timeout))
while [ $SECONDS -lt $end_time ]; do
if check_health; then
echo "The $process_name process has started successfully!"
exit 0
fi
sleep 1
done
echo "The startup time is more than $timeout seconds, the $process_name process may not start successfully!"
kill $pid # Ensure the process does not linger if startup fails
else
echo "This node does not have the curl command, please manually check whether the $process_name process is successfully started"
fi
else
exec $LIMIT $JAVA $final_java_opt com.starrocks.StarRocksFE ${HELPER} ${HOST_TYPE} "$@" </dev/null
fi
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
conf_file="$STARROCKS_HOME/conf/cn.conf" | ||
fi | ||
|
||
http_port=$(grep -v ^# $conf_file |grep be_http_port| sed 's/.*= *//') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this already loaded by export_env_from_conf $STARROCKS_HOME/conf/cn.conf
in line 72
@@ -206,14 +215,47 @@ fi | |||
if [ ${RUN_LOG_CONSOLE} -eq 1 ] ; then | |||
# force glog output to console (stderr) | |||
export GLOG_logtostderr=1 | |||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't remove this, it'll break the assumption that crash core will be redirected to be.out/cn.out
fi | ||
|
||
echo "start time: $(date), server uptime: $(uptime)" | ||
check_health() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really tricky. I am inclined not to do so in start script. the --daemon
is a simplest way to provide a daemonized
launched solution, but usually it is not enough in production without watchdog. so A supervisor or systemd-service will be prefered to launch the service without --daemon
and additional healthy/probing methods can be applied out of the start script and control whether need to restart/kill the process with supervisorctl restart <fe/be/cn>
or systemctl restart <fe/be/cn>
.
Why I'm doing:
What I'm doing:
Fixes #48369
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: