Problems running deepstream application at boot

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU): Jetson Nano
• DeepStream Version: 5.0
• JetPack Version (valid for Jetson only): 4.4 [L4T 32.4.3]

Hello everyone, I am writing because I have the following query. What is the proper way to run a deepstream application at boot time?

The application I want to run is on a remote device (Jetson Nano), which reads two sources (RTSP streams) of video, and then performs the sequence pgie-> tracker-> analytics. Finally it publishes the results of “LineCrossing” of the analytics plugin, in an AWS IoT Core (MQTT) topic. In parallel to the publication of messages, in a second sink, a streaming (RTSP) of the processed video is performed.

The results obtained are the following:

  • If I manually run the application: It runs correctly, publishing messages at intervals of 10 seconds (every 250 frames).

  • If I manually run the service (sudo systemctl start deepstream.service): The service runs, however from what I can see, the frequency of sending published messages is not the desired one (app every 16 seconds). I have also been able to observe some messages published twice.

  • When the service tries to start after booting, it generates a series of errors that can be seen below.

I have seen that when I run the application and the input source is a video file (not RTSP source), apparently the service manages to start correctly after booting. The configured service file is as follows:

[Unit]
Description=Deepstream Service
After=network.target

[Service]
Type=simple
ExecStart=<Path to Application + Args>
User=nano
WorkingDirectory=<Path to Application>
Restart=on-failure
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target

Has anyone had similar problems or have any idea that it may be generating errors?

I haven’t seen your exact errors but I don’t believe you have a guaranteed internet connection with this After=network.target.
What I do is use a python wrapper program for my deepstream app. The python wrapper program is configured as a systemd service.

In the python wrapper program it polls for a real internet connection (there are many ways but here’s an example: https://stackoverflow.com/questions/3764291/checking-network-connection).

Only after we have internet do I start communicating with AWS IoT and start my deepstream app (see the subprocess module).

1 Like

Thank you very much for your answer @jasonpgf2a, the approach you mention is interesting and should work. I read that one of the “official” deploy mechanisms is through docker, but I haven’t been able to do it yet.

See 3.1 APPLICATIONS MAY BE DEPLOYED IN A DOCKER CONTAINER

Yes thats correct you can use docker but you will still have the issue of starting your service at boot of course. ;-)

1 Like

Thank you very much, it worked. Being 22:45 in Chile, I can go to sleep peacefully.

1 Like