Deepstream won't allow system to suspend

Hi,

I’m develping an application which uses Deepstream on a Jetson Xavier. Given some GPIO conditions, the system is supposed to go to sleep (sudo sytemctl suspend). However, if the application is running the deepstream plugins for gstreamer, the system tries but does not succeed to go to sleep state.

If runing a simple GStreamer pipeline, this does not happen.
To reproduce:

(terminal A):

cd /opt/nvidia/deepstream/deepstream-4.0/sources/apps/sample_apps/deepstream-test1
./deepstream-test1-app /opt/nvidia/deepstream/deepstream-4.0/samples/streams/sample_720p.h264

(terminal B):

sudo systemctl suspend --force

The same happens when running GS directly:

gst-launch-1.0 filesrc location=streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_0 nvstreammux name=m batch-size=1 width=1920 height=1080 ! nvinfer config-file-path= configs/deepstream-app/config_infer_primary.txt batch-size=1 unique-id=1 ! nvtracker ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_mot_klt.so ! nvinfer config-file-path= configs/deepstream-app/config_infer_secondary_carcolor.txt batch-size=16 unique-id=2 infer-on-gie-id=1 infer-on-class-ids=0 ! nvmultistreamtiler rows=1 columns=1 width=1280 height=720 ! nvvideoconvert ! nvdsosd ! nvegltransform ! nveglglessink

Suspend logs:

$ systemctl list-dependencies -a suspend.target
suspend.target
    systemd-suspend.service
        system.slice
             -.slice
        sleep.target

$ journalctl -r -u systemd-suspend.service
-- Logs begin at Thu 2020-04-30 12:25:55 -04, end at Thu 2020-04-30 13:06:24 -04. --
abr 30 12:40:57 javier2 systemd[1]: Failed to start Suspend.
abr 30 12:40:57 javier2 systemd[1]: systemd-suspend.service: Failed with result 'exit-code'.
abr 30 12:40:57 javier2 systemd[1]: systemd-suspend.service: Main process exited, code=exited, status=1/FAILURE
abr 30 12:40:53 javier2 systemd-sleep[13481]: Suspending system...
abr 30 12:40:53 javier2 systemd[1]: Starting Suspend...

$ systemctl status systemd-suspend.service
  systemd-suspend.service - Suspend
   Loaded: loaded (/lib/systemd/system/systemd-suspend.service; static; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2020-04-30 12:40:57 -04; 26min ago
     Docs: man:systemd-suspend.service(8)
  Process: 13481 ExecStart=/lib/systemd/systemd-sleep suspend (code=exited, status=1/FAILURE)
 Main PID: 13481 (code=exited, status=1/FAILURE)

abr 30 12:40:53 javier2 systemd[1]: Starting Suspend...
abr 30 12:40:53 javier2 systemd-sleep[13481]: Suspending system...
abr 30 12:40:57 javier2 systemd[1]: systemd-suspend.service: Main process exited, code=exited, status=1/FAILURE
abr 30 12:40:57 javier2 systemd[1]: systemd-suspend.service: Failed with result 'exit-code'.
abr 30 12:40:57 javier2 systemd[1]: Failed to start Suspend.

EDIT:
gst-launch-1.0 videotestsrc ! videoconvert ! nvvideoconvert ! nveglglessink does allow suspend.

maybe it’s something from nvinfer?

EDIT 2:
The same happens when running using gst-launch or the compiled deepstream-test-xxx

Hi,
Since DeepStream SDK occupies much hardware resources(NVDEC, GPU, DISPLAY, …),we would like to suggest terminate the pipeline before going ot suspend mode.