Hi All,
I’m using Jetson Xavier NX (?) with DS 6.0.0 installed.
My app is based on deepstream-app
and is configured to send messages to a Kafka server.
It works fine and the only change I wanted to make is to run it is a service that starts on boot.
I accomplished that by creating systemd
unit for my app:
[Unit]
Description=start app as a service on boot
After=nvds_logger.service
[Service]
ExecStart=/home/user/project/app/bin/systemd/start_app_as_service.sh
Restart=always
RestartSec=60
[Install]
WantedBy=multi-user.target
start_app_as_service.sh is just a simple script:
#!/bin/bash
APP_DIR=/home/user/project/app
GST_DEBUG=ERROR $APP_DIR/bin/app -c $APP_DIR/config/app.cfg >> $APP_DIR/log 2>&1
When my Kafka server is up and running and the Jetson reboots, the app starts normally and I can see it communicates with the server by checking sudo systemctl status app.service
.
If I then shut down the Kafka server, I get error messages in the nvds_logger file and also in sudo systemctl status app.service
.
So far so good.
However, if my Kafka server is down and I reboot the Jetson, the app starts normally, there is no errors in the nvds_logger file and sudo systemctl status app.service
shows no errors as well - pretty weird, I expected the app to fail because the server is not up.
By trial and error I managed to get what I want by adding a delay to the [Service]
section of my app’s unit:
ExecStartPre=/bin/sleep 30
So it looks like for some reason when the app is started at boot time, the broker is unable to detect that there is no connection with the server (perhaps no network connection at all), maybe because something else has not started yet?
Can anyone more familiar with the matter comment on it?
I’m happy that my config is working but it’s either a) something wrong with my approach or b) there is a bug in Kafka broker code.
In any case I’d love to know more about the issue.
p.s I take it that I need to call setup_nvds_logger.sh
after every reboot and I do so by using the same systemd technique. What I don’t quite understand is why errors like “Kafka broker is down” appear in the nvds_logger file but on the screen I get only this:
ERROR from sink_sub_bin_sink1: Could not configure supporting library.
Debug info: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvmsgbroker/gstnvmsgbroker.cpp(402): legacy_gst_nvmsgbroker_start (): /GstPipeline:pipeline/GstBin:sink_sub_bin1/GstNvMsgBroker:sink_sub_bin_sink1:
unable to connect to broker library
ERROR from sink_sub_bin_sink1: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
To me the error message “unable to connect to broker library” sounds incorrect because I know for a fact that the reason for that is it is unable to connect to the server, which is quite different (and that’s exactly what it outputs to the nvds_logger file only).
Ideally I would like to have all warnings/errors produced by the app in one place and currently I’m trying to achieve that by redirecting its output to file:
./bin/app -c config/app.cfg >> log 2>&1
but it lacks those error messages that appear in nvds_logger file.
What should I change to achieve my goal?