T
T
tugo2021-05-25 17:45:57
linux
tugo, 2021-05-25 17:45:57

Why is there a difference in running an application through systemd and manually?

Good afternoon!

Given: Rasperry Pi 4, application on Qt 5.15.2, QML, Raspbian OS Lite. The application is launched with the eglfs plugin. X11 won't start.
Autostart is configured with this systemd script.

spoiler

[Unit]
Description=Example systemd service.

[Service]
User=user
Group=user
Type=simple
ExecStart=/home/user/deploy/myapp/myapp.sh
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target



The application contains the following code for displaying the webcam image.
spoiler

Item {
                Component {
                    id: cameraComponent

                    VideoOutput {
                        source: camera
                        focus: visible
                        Camera {
                            id: camera
                            captureMode: Camera.CaptureViewfinder
                        }
                    }
                }

                Loader {
                    id: cameraLoader
                    anchors.fill: parent
                    sourceComponent: cameraComponent
                    asynchronous: true

                    function show() {
                        sourceComponent = cameraComponent
                    }
                    function hide() {
                        sourceComponent = undefined
                    }
                }
            }


Problem.
When running an application through systemd and displaying the camera output, the application eats up 90 percent of the CPU according to htop. When you start the application, you can immediately see that something is already wrong - htop shows that the application has eaten up 145 MB of memory, although the page with the camera is not yet displayed and the CPU is not yet 90% loaded.
When manually started, the CPU is consumed by 15-20% and the memory is 115 MB.
What can be wrong? And how to find the root of the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jacob E, 2021-05-26
@Zifix

Try to write environment variables to file and compare in both cases.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question