Argus error

When I test using the Argus program, I can initially fetch images normally, but after a long period of inactivity, the following error is reported. What is causing this? How can I fix it

(Argus) Error Timeout: (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamerautils/inc/QueueImpl.h, function dequeueWait(), line 260)
(Argus) Error Timeout: Failed to dequeue next request - exiting encoder work thread (in src/eglstream/JPEGEncoder.cpp, function run(), line 478)

        Argus::Status status;
        std::vector<std::string> filenames;
        std::mutex mtx;
#pragma omp parallel for
        for (int i = 0; i < _capture_holders.size(); i++)
        {
            auto hold = _capture_holders[i];
            if(!hold->getInitState()){
                ErrorL << hold->getSensorName() << " init error!";
                continue;
            }
            ICaptureSession *iCaptureSession = interface_cast<ICaptureSession>(hold->getSession());
            Request *request = hold->getRequest();
            uint32_t frameId = iCaptureSession->capture(request);
            if (frameId == 0)
            {
                PrintE("Failed to submit capture request for camera");
                continue;
            }
            {
                Argus::Status state;
                EGLStream::IFrameConsumer *iFrameConsumer = Argus::interface_cast<EGLStream::IFrameConsumer>(hold->getConsumer());
                CONTINUE_IF_NULL(iFrameConsumer,"Failed to initialize Consumer for camera");
                Argus::UniqueObj<EGLStream::Frame> frame(iFrameConsumer->acquireFrame(_timeout, &state));
                EGLStream::IFrame *iFrame = Argus::interface_cast<EGLStream::IFrame>(frame);
                CONTINUE_IF_NULL(iFrame, "Failed to get IFrame interface");

                EGLStream::Image *image = iFrame->getImage();
                CONTINUE_IF_NULL(image, "Failed to get Image from iFrame->getImage()");

                EGLStream::IImageJPEG *iImageJPEG = Argus::interface_cast<EGLStream::IImageJPEG>(image);
                CONTINUE_IF_NULL(iImageJPEG, "Failed to get ImageJPEG Interface");
                // printf("num %lld, %lld\r\n", iFrame->getNumber(), iFrame->getTime());
                
                std::string filename = autotest::getCurrentWorkingDir() + "/media/" + hold->getSensorName() + "-" + std::to_string(iFrame->getTime()) + ".jpg";
                toolkit::File::create_file(filename.c_str(),"w");
                status = iImageJPEG->writeJPEG(filename.c_str());
                CONTINUE_IF_NOT_OK(status, "Failed to write JPEG");
                {
                    std::lock_guard<std::mutex> lock(mtx);
                    filenames.push_back(GENERATE_DATA(hold->getSensorName(),filename));
                }
            }

            iCaptureSession->waitForIdle();
            // Shut down Argus.
        }
        cameraProvider.reset();


        std::ostringstream oss;
        for (size_t i = 0; i < filenames.size(); i++)
        {
            oss << filenames[i];
            if (i != filenames.size() - 1)
            {
                oss << "|"; // 添加逗号
            }
        }
        InfoL << oss.str().c_str();
        char files[1024];
        memcpy(files,oss.str().c_str(),oss.str().size());
        int ret = _pipe_wrap.write(files, oss.str().size());
        return ret;
    }

Hello @550399056,

How is it going?

Please allow me to ask a couple of questions just tomato sure we are getting the full picture here.

  1. When you say a period of inactivity, do you mean a period where the app is still running but not doing anything with it or just a period where the Jetson is not interacting with the camera at all?

  2. Have you tried using GStreamer to capture video and see if the same error shows?

  3. What is your end goal? What do you want to achieve with the images captured?

best regards,
Andrew
Embedded Software Engineer at ProventusNova

  1. yes, do nothing, but not interacting with the camera at all.
  2. not sure, just oneshot. or there has always been interaction.
  3. just capture image. When need an image, just take a photo.

(Argus) Error Timeout: (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamerautils/inc/QueueImpl.h, function dequeueWait(), line 260)
(Argus) Error Timeout: Failed to dequeue next request - exiting encoder work thread (in src/eglstream/JPEGEncoder.cpp, function run(), line 478)

Is this error caused by something not being released?

Hello @550399056,

Thanks for getting back with further details.

It seems like the way you are trying to capture a snapshot with the camera it is failing to acquire a resource or something.

That being said, the code you posted seems a bit too complex to just capture a single picture.

Would it be possible for you to test the following pipeline?

gst-launch-1.0 nvarguscamerasrc num-buffers=1 ! nvvidconv ! pngenc ! filesink location=test.png

Try restarting the board before running the test, just to make sure there are not tied resources due to the original error.

best regards,
Andrew
Embedded Software Engineer at ProventusNova

I want to integrate this oneShot code into our code, and then execute it whenever I want to take a photo,Cannot execute directly using commands.

What the BSP version?

cat /etc/nv_tegra_release

Maybe check below looking for possible solution.

R35 (release), REVISION: 6.0, GCID: 37391689, BOARD: t186ref, EABI: aarch64, DATE: Wed Aug 28 09:12:27 UTC 2024

Apply the patch from below.

[ARGUS stability]

(Argus) Error Timeout: (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamerautils/inc/QueueImpl.h, function dequeueWait(), line 260)
(Argus) Error Timeout: Failed to dequeue next request - exiting encoder work thread (in src/eglstream/JPEGEncoder.cpp, function run(), line 478)

We replaced the .so file, but the problem still persists. pls help!