jitsi / jitsi-videobridge

Jitsi Videobridge is a WebRTC compatible video router or SFU that lets build highly scalable video conferencing infrastructure (i.e., up to hundreds of conferences per server).
https://jitsi.org/jitsi-videobridge
Apache License 2.0
2.91k stars 989 forks source link

Jitsi Videobridge won't start after Update with NullPointerException in Main.java:78 #1352

Open taladar opened 4 years ago

taladar commented 4 years ago

Since the update of the Debian package jitsi-videobridge2 (2.1-202-g5f9377b9-1 to 2.1-273-g072dd44b-1) our Puppet-configured (but largely identical to the config the old Debian-packages tried to auto-magically create with way too much postinstall magic for my taste) jitsi-videobridge2.service Service does not start any more.

It crashes with the very helpful

Exception in thread "main" java.lang.NullPointerException
        at org.jitsi.videobridge.Main.main(Main.java:78)

When comparing the two Debian packages I noticed that apparently the xmpp value for --apis is no longer supported and that the parameters that had previously been in the systemd unit had been moved to JVB_OPTS but even that change did not change the behaviour.

Lines 76-78 of Main.java in the latest version seem to be

            System.setProperty(
                    Videobridge.REST_API_PNAME,
                    Boolean.toString(apis.contains(Videobridge.REST_API)));

which to me does not seem like a place where we should get a NullPointerException even if we misconfigure things.

It also does not seem like a place where additional log-levels or logs would produce much insight.

Our /etc/jitsi/videobridge/config looks like this after the adjustments mentioned above (JVB_HOSTNAME and JVB_SECRET redacted)

# Jitsi Videobridge settings

# sets the XMPP domain (default: none)
JVB_HOSTNAME="re.dac.ted"

# sets the hostname of the XMPP server (default: domain if set, localhost otherwise)
JVB_HOST=

# sets the port of the XMPP server (default: 5275)
JVB_PORT=5347

# sets the shared secret used to authenticate to the XMPP server
JVB_SECRET="<redacted>"

# extra options to pass to the JVB daemon
JVB_OPTS="--host=${JVB_HOST:-localhost} --domain=${JVB_HOSTNAME} --port=${JVB_PORT} --secret=${JVB_SECRET} –apis=rest"

# adds java system props that are passed to jvb (default are for home and logging config file)
JAVA_SYS_PROPS="-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/etc/jitsi -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=videobridge -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/jitsi -Djava.util.logging.config.file=/etc/jitsi/videobridge/logging.properties"

and the systemd unit as seen by systemctl cat jitsi-videobridge2.service

# /lib/systemd/system/jitsi-videobridge2.service
[Unit]
Description=Jitsi Videobridge
After=network-online.target
Wants=network-online.target

[Service]
SuccessExitStatus=143
# allow bind to 80 and 443
AmbientCapabilities=CAP_NET_BIND_SERVICE
EnvironmentFile=/etc/jitsi/videobridge/config
Environment=LOGFILE=/var/log/jitsi/jvb.log
User=jvb
RuntimeDirectory=jitsi-videobridge
RuntimeDirectoryMode=0750
PIDFile=/var/run/jitsi-videobridge/jitsi-videobridge.pid
# more threads for this process
TasksMax=65000
# allow more open files for this process
LimitNPROC=65000
LimitNOFILE=65000
ExecStart=/bin/bash -c "exec /usr/share/jitsi-videobridge/jvb.sh ${JVB_OPTS} < /dev/null >> ${LOGFILE} 2>&1"
ExecStartPost=/bin/bash -c "echo $MAINPID > /var/run/jitsi-videobridge/jitsi-videobridge.pid"

[Install]
WantedBy=multi-user.target

What can we do to get our video bridge up and running again?

damencho commented 4 years ago

Hum –apis=rest was that edited by you? It should be --apis=rest

taladar commented 4 years ago

Well spotted. That seems to have been the problem. I really would like to know where that character came from though since I can not usually enter anything but the regular dash on my keyboard. Anyway, that fixed the issue, though I still think if --apis is missing the program should show something more meaningful than a NullPointerException.