iscDevCreate: Failed - add isc dev driver /dev/isc-dev.-191861913 - Bad file descriptor

I wrote some tests of my pipeline which I want to run sequentially. In each test I create a pipeline and components and tear them down to ensure they always start clean and tear down successfully.

Running the tests individually seems to work fine. But when I run them sequentially I get the following error when attempting to bring up the pipeline again.

iscDevCreate: Failed - add isc dev driver /dev/isc-dev.-191861913 - Bad file descriptor
NvMediaISCDeviceCreate: Cannot create isc dev
nvmedia: ERROR: Init: Failed to create image sensor device
nvmedia isc: IscPwrCtrlIsExternalComm: 832: Need to call IscPwrCtrlInit() before calling this function
iscRootDevClose: Invalid platform
NvMediaISCRootDeviceDestroy: iscRootDevClose failed
Segmentation fault

Am I not shutting something down properly in the first test? Is it valid to be able to construct/destruct a pipeline multiple times in the same process?

My pipeline is using the NVMEDIA_IPP_COMPONENT_FILE_READER as a capture source.

Dear daden55vvg,
Could you share code snippet on how you are doing it?

Each test does something like the snippet below. The tests are running sequentially in the same process and push about 10 images through the file reader component.

NvMediaDevice *device_ = NvMediaDeviceCreate();
ext_img_device_ = ExtImgDevInit(params);
manager_ = NvMediaIPPManagerCreate(NVMEDIA_IPP_VERSION_INFO, device_);
pipeline_ = NvMediaIPPPipelineCreate(manager_);

// setup triggered mode.
bool triggered = NVMEDIA_TRUE;
constexpr size_t PROP_SIZE = 2;
NvMediaIPPPipelineProperty properties[PROP_SIZE];
properties[0].type = NVMEDIA_IPP_PIPELINE_PROPERTY_TRIGGER_BASED_CAPTURE;
properties[0].value = &triggered;
uint32_t frame_delay = 0;
// Set this to indicate take settings immediately, but didn't have any noticeable effect.
properties[1].type = NVMEDIA_IPP_PIPELINE_PROPERTY_SETTINGS_DELAY;
properties[1].value = &frame_delay;
CHECK_NVMEDIA_STATUS_OK(
    NvMediaIPPPipelineSetProperties(pipeline_, PROP_SIZE, properties));

components = file_reader, isp, acp, isc, output;
// Create Components
for each component { NvMediaIPPComponentCreateNew(...); }

// Attach Components
for each component { NvMediaIPPComponentAttach(...); }

// Process images
for (image in images) {
  queue_.push(image);
  // For some reason this triggers continuous reader call backs until
  // the pool is consumed.
  NvMediaIPPPipelineSingleCapture(...);
}

// Images are pushed to the reader callback image queue and processed in the ISP.
...

// When all images are done being processed cleanup
// Stop Pipeline
NvMediaIPPPipelineStop(...);

// Destroy Components
for each component { NvMediaIPPComponentDestroy(...); }

NvMediaIPPPipelineDestroy(pipeline_);
NvMediaIPPManagerDestroy(manager_);
ExtImgDevDeinit(ext_img_device_);
NvMediaDeviceDestroy(device_);

Any idea why I would get this?

Dear daden55vvg,
Below is definitely wrong
manager_ = NvMediaIPPManagerCreate(NVMEDIA_IPP_VERSION_INFO, ext_img_device_);
NvMediaManagerCreate takes a pointer to the NvMediaDevice, not ExtImgDevice.
Could you check testing it again after fixing this issue.

Sorry, that was a mistype as I was transcribing code. I am using NvMediaDevice and I have updated the code snipit above to reflect what the code is doing. The error still persists.

Dear daden55vvg,
Could you share the ExtImgDev parameters used in below line.

ext_img_device_ = ExtImgDevInit(params)