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

Selenium grid v3.10.0 doesn't start at docker container #5575

Comments

@VitarLaeda
Copy link

Meta -

OS:
Docker container
Selenium Version:
3.10.0

Grid

Expected Behavior -

Correct start of selenium grid in docker container
With selenium 3.9.1 all works correctly

Actual Behavior -

Container doesn't start

Exception in thread "main" java.lang.NullPointerException
at org.openqa.grid.internal.cli.GridHubCliOptions.lambda$defaults$0(GridHubCliOptions.java:52)
at com.beust.jcommander.JCommander.initializeDefaultValue(JCommander.java:662)
at com.beust.jcommander.JCommander.initializeDefaultValues(JCommander.java:356)
at com.beust.jcommander.JCommander.parse(JCommander.java:339)
at com.beust.jcommander.JCommander.parse(JCommander.java:319)
at org.openqa.grid.internal.cli.GridHubCliOptions.parse(GridHubCliOptions.java:42)

Steps to reproduce -

link to GitHub repository or

config :

#!/bin/bash

echo "
{
  \"host\": null,
  \"port\": 4444,
  \"prioritizer\": null,
  \"capabilityMatcher\": \"org.openqa.grid.internal.utils.DefaultCapabilityMatcher\",
  \"throwOnCapabilityNotPresent\": true,
  \"newSessionWaitTimeout\": $GRID_NEW_SESSION_WAIT_TIMEOUT,
  \"jettyMaxThreads\": $GRID_JETTY_MAX_THREADS,
  \"nodePolling\": $GRID_NODE_POLLING,
  \"cleanUpCycle\": $GRID_CLEAN_UP_CYCLE,
  \"timeout\": $GRID_TIMEOUT,
  \"browserTimeout\": $GRID_BROWSER_TIMEOUT,
  \"maxSession\": $GRID_MAX_SESSION,
  \"unregisterIfStillDownAfter\": $GRID_UNREGISTER_IF_STILL_DOWN_AFTER
}"

Dockerfile :

FROM netflixoss/java:8

#------------------------------------------------
# Customize sources for apt-get
#------------------------------------------------

RUN  mkdir -p /opt/selenium \
    && wget --no-verbose http://selenium-release.storage.googleapis.com/3.10/selenium-server-standalone-3.10.0.jar \
    -O /opt/selenium/selenium-server-standalone.jar

RUN useradd seluser --shell /bin/bash --create-home \
  && usermod -a -G sudo seluser \
  && echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \
  && echo 'seluser:secret' | chpasswd

#------------------------
# Selenium Configuration
#------------------------

EXPOSE 4444
EXPOSE 5555

ENV GRID_NEW_SESSION_WAIT_TIMEOUT 0
ENV GRID_JETTY_MAX_THREADS -1
ENV GRID_NODE_POLLING  5000
ENV GRID_CLEAN_UP_CYCLE 5000
ENV GRID_TIMEOUT 30000
ENV GRID_BROWSER_TIMEOUT 60000
ENV GRID_MAX_SESSION 5
ENV GRID_UNREGISTER_IF_STILL_DOWN_AFTER 30000

COPY generate_config /opt/selenium/generate_config
COPY entry_point.sh /opt/bin/entry_point.sh
RUN chmod a+rx /opt/bin/entry_point.sh
RUN chmod a+rx /opt/selenium/generate_config

RUN chown -R seluser /opt/selenium

USER seluser

CMD ["/opt/bin/entry_point.sh"]

entry_point.sh :

#!/bin/bash

ROOT=/opt/selenium
CONF=$ROOT/config.json

. $ROOT/generate_config >$CONF
echo "starting selenium hub with configuration:"
cat $CONF

if [ ! -z "$SE_OPTS" ]; then
  echo "appending selenium options: ${SE_OPTS}"
fi

function shutdown {
    echo "shutting down hub.."
    kill -s SIGTERM $NODE_PID
    wait $NODE_PID
    echo "shutdown complete"
}

java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
  -role hub \
  -hubConfig $CONF \
  ${SE_OPTS} &
NODE_PID=$!

trap shutdown SIGTERM SIGINT
wait $NODE_PID

@VitarLaeda VitarLaeda changed the title Selenium grid doesn't start at docker container Selenium grid v3.10.0 doesn't start at docker container Mar 7, 2018
@akeshmiri
Copy link

+1, same configuration, same error

@akeshmiri
Copy link

I think I found the root cause of issue after code investigation.
The problem is that in generate_config.sh inside docker there is a parameter "prioritizer": null,

In selenium, GridHubCliOptions -> defaults method, line 52 we have

  return map.containsKey(option) ? map.get(option).toString() : null;

Short term solution is to remove "prioritizer": null,, for long term, I think selenium code should be updated to handle null values.

@barancev
Copy link
Member

The fix will be shipped as part of release 3.11

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.