Skip to content

Commit

Permalink
Update the condition to set ulimit for VNC and noVNC
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Jan 10, 2024
1 parent d6beb06 commit c706217
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -5,7 +5,7 @@ BASE_RELEASE := $(or $(BASE_RELEASE),$(BASE_RELEASE),selenium-4.16.0)
BASE_VERSION := $(or $(BASE_VERSION),$(BASE_VERSION),4.16.1)
BASE_RELEASE_NIGHTLY := $(or $(BASE_RELEASE_NIGHTLY),$(BASE_RELEASE_NIGHTLY),nightly)
BASE_VERSION_NIGHTLY := $(or $(BASE_VERSION_NIGHTLY),$(BASE_VERSION_NIGHTLY),4.17.0-SNAPSHOT)
VERSION := $(or $(VERSION),$(VERSION),$(BASE_VERSION))
VERSION := $(or $(VERSION),$(VERSION),4.16.1)
TAG_VERSION := $(VERSION)-$(BUILD_DATE)
CHART_VERSION_NIGHTLY := $(or $(CHART_VERSION_NIGHTLY),$(CHART_VERSION_NIGHTLY),1.0.0-nightly)
NAMESPACE := $(or $(NAMESPACE),$(NAMESPACE),$(NAME))
Expand Down Expand Up @@ -36,6 +36,8 @@ all: hub \
standalone_docker \
video

build_nightly:
BASE_VERSION=$(BASE_VERSION_NIGHTLY) BASE_RELEASE=$(BASE_RELEASE_NIGHTLY) make build

build: all

Expand Down
13 changes: 13 additions & 0 deletions NodeBase/start-novnc.sh
Expand Up @@ -5,6 +5,19 @@
if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
if [ "${START_VNC:-$SE_START_VNC}" = true ] ; then
if [ "${START_NO_VNC:-$SE_START_NO_VNC}" = true ] ; then

# Guard against unreasonably high nofile limits. See https://github.com/SeleniumHQ/docker-selenium/issues/2045
ULIMIT=${SE_VNC_ULIMIT:-100000}
if [[ ${ULIMIT} -ge 100000 ]]; then
echo "Trying to update the open file descriptor limit from $(ulimit -n) to ${ULIMIT}."
ulimit -Sv ${ULIMIT}
if [ $? -eq 0 ]; then
echo "Successfully update the open file descriptor limit."
else
echo "The open file descriptor limit could not be updated."
fi
fi

/opt/bin/noVNC/utils/novnc_proxy --listen ${NO_VNC_PORT:-$SE_NO_VNC_PORT} --vnc localhost:${VNC_PORT:-$SE_VNC_PORT}
else
echo "noVNC won't start because SE_START_NO_VNC is false."
Expand Down
7 changes: 4 additions & 3 deletions NodeBase/start-vnc.sh
Expand Up @@ -45,9 +45,10 @@ if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
done

# Guard against unreasonably high nofile limits. See https://github.com/SeleniumHQ/docker-selenium/issues/2045
if [[ $(ulimit -n) -gt 200000 || ! -z "${SE_VNC_ULIMIT}" ]]; then
echo "Trying to update the open file descriptor limit from $(ulimit -n) to ${SE_VNC_ULIMIT:-65536}."
ulimit -n ${SE_VNC_ULIMIT:-65536}
ULIMIT=${SE_VNC_ULIMIT:-100000}
if [[ ${ULIMIT} -ge 100000 ]]; then
echo "Trying to update the open file descriptor limit from $(ulimit -n) to ${ULIMIT}."
ulimit -Sv ${ULIMIT}
if [ $? -eq 0 ]; then
echo "Successfully update the open file descriptor limit."
else
Expand Down

0 comments on commit c706217

Please sign in to comment.