File tree 2 files changed +14
-10
lines changed
2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,14 @@ if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
7
7
if [ " ${START_NO_VNC:- $SE_START_NO_VNC } " = true ] ; then
8
8
9
9
# Guard against unreasonably high nofile limits. See https://github.com/SeleniumHQ/docker-selenium/issues/2045
10
- ULIMIT=${SE_VNC_ULIMIT:- 100000}
11
- if [[ ${ULIMIT} -ge 100000 ]]; then
12
- echo " Trying to update the open file descriptor limit from $( ulimit -n) to ${ULIMIT} ."
13
- ulimit -Sv ${ULIMIT}
10
+ # Try to set a new limit if the current limit is too high, or the user explicitly specified a custom limit
11
+ TOO_HIGH_ULIMIT=100000
12
+ if [[ $( ulimit -n) -gt $TOO_HIGH_ULIMIT || ! -z " ${SE_VNC_ULIMIT} " ]]; then
13
+ NEW_ULIMIT=${SE_VNC_ULIMIT:- ${TOO_HIGH_ULIMIT} }
14
+ echo " Trying to update the open file descriptor limit from $( ulimit -n) to ${NEW_ULIMIT} ."
15
+ ulimit -n ${NEW_ULIMIT}
14
16
if [ $? -eq 0 ]; then
15
- echo " Successfully update the open file descriptor limit."
17
+ echo " Successfully updated the open file descriptor limit."
16
18
else
17
19
echo " The open file descriptor limit could not be updated."
18
20
fi
Original file line number Diff line number Diff line change @@ -45,12 +45,14 @@ if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
45
45
done
46
46
47
47
# Guard against unreasonably high nofile limits. See https://github.com/SeleniumHQ/docker-selenium/issues/2045
48
- ULIMIT=${SE_VNC_ULIMIT:- 100000}
49
- if [[ ${ULIMIT} -ge 100000 ]]; then
50
- echo " Trying to update the open file descriptor limit from $( ulimit -n) to ${ULIMIT} ."
51
- ulimit -Sv ${ULIMIT}
48
+ # Try to set a new limit if the current limit is too high, or the user explicitly specified a custom limit
49
+ TOO_HIGH_ULIMIT=100000
50
+ if [[ $( ulimit -n) -gt $TOO_HIGH_ULIMIT || ! -z " ${SE_VNC_ULIMIT} " ]]; then
51
+ NEW_ULIMIT=${SE_VNC_ULIMIT:- ${TOO_HIGH_ULIMIT} }
52
+ echo " Trying to update the open file descriptor limit from $( ulimit -n) to ${NEW_ULIMIT} ."
53
+ ulimit -n ${NEW_ULIMIT}
52
54
if [ $? -eq 0 ]; then
53
- echo " Successfully update the open file descriptor limit."
55
+ echo " Successfully updated the open file descriptor limit."
54
56
else
55
57
echo " The open file descriptor limit could not be updated."
56
58
fi
You can’t perform that action at this time.
0 commit comments