librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

Sometimes depth stream blocked on single-frame pipe

Open reuksv opened this issue 1 year ago • 14 comments


Required Info
Camera Model { D400 }
Operating System & Version {Ubuntu 20}

Issue Description

A simple code of this kind sometimes (perhaps after hundreds or thousands of iterations) blocks the depth stream and prevents new frames from being received

//config enabled only depth stream
pipe->start(*config);
pipe->wait_for_frames();
pipe->stop();

In realsense viewer, if you enable the display of depth frames, you will see the message "No frames recieved" The only thing that helps is the physical plugging of the wire. I checked on several different sensors and wires. Is there any way to avoid this behavior?

reuksv avatar May 28 '24 10:05 reuksv

Hi @reuksv How does it behave if you use a frames variable with wait_for_frames() and then use the keep() instruction to store the frames in the computer's memory?

//config enabled only depth stream
pipe->start(*config);
frames = pipe->wait_for_frames();
frames->keep();
pipe->stop();

MartyG-RealSense avatar May 28 '24 11:05 MartyG-RealSense

Hi @reuksv How does it behave if you use a frames variable with wait_for_frames() and then use the keep() instruction to store the frames in the computer's memory?

//config enabled only depth stream
pipe->start(*config);
frames = pipe->wait_for_frames();
frames->keep();
pipe->stop();

Hello @MartyG-RealSense No changes have occurred.

reuksv avatar May 29 '24 11:05 reuksv

I would next recommend using an Ubuntu system monitoring tool such as htop to monitor the available memory on the computer whilst the program is running and see whether it is progressively declining over time as the program repeatedly iterates. Such a reduction is known as a memory leak and can result in a program becoming unstable or crashing once the free memory becomes low enough.

MartyG-RealSense avatar May 29 '24 15:05 MartyG-RealSense

I would next recommend using an Ubuntu system monitoring tool such as htop to monitor the available memory on the computer whilst the program is running and see whether it is progressively declining over time as the program repeatedly iterates. Such a reduction is known as a memory leak and can result in a program becoming unstable or crashing once the free memory becomes low enough.

@MartyG-RealSense I've been monitoring, there are no leaks. I also clarified that the Fail happens very randomly. This can happen on the tenth iteration, for example.

reuksv avatar May 30 '24 09:05 reuksv

Does the issue still occur if you put a value in the brackets of the wait_for_frames instruction such as 1000?

pipe->wait_for_frames(1000);

MartyG-RealSense avatar May 30 '24 11:05 MartyG-RealSense

The problem still remains

reuksv avatar May 31 '24 08:05 reuksv

How does the program behave if the stop instruction is commented out and the pipeline is permitted to run continuously without multiple start-stops?

MartyG-RealSense avatar May 31 '24 14:05 MartyG-RealSense

Works good

reuksv avatar May 31 '24 14:05 reuksv

If your project requires repeated start-stop cycles instead of running continuously then you could try putting a short sleep command before the pipe start line to see whether a small time wait before starting the pipeline also helps to reduce the likelihood of a problem occurring.

MartyG-RealSense avatar May 31 '24 16:05 MartyG-RealSense

No changes have occurred.

reuksv avatar Jun 01 '24 09:06 reuksv

Next, please try placing a camera reset instruction before the pipe start line in your script using the Python code below. This should have the same effect as performing an unplug-replug of the USB cable.

ctx = rs.context()
devices = ctx.query_devices()
for dev in devices:
dev.hardware_reset()

MartyG-RealSense avatar Jun 01 '24 11:06 MartyG-RealSense

Hi @reuksv Do you require further assistance with this case, please? Thanks!

MartyG-RealSense avatar Jun 06 '24 09:06 MartyG-RealSense

@MartyG-RealSense Unfortunately, I haven't had time to check the last tip yet. Please do not close the ticket yet

reuksv avatar Jun 06 '24 10:06 reuksv

It's no problem at all to keep it open. Thanks very much for the update!

MartyG-RealSense avatar Jun 06 '24 11:06 MartyG-RealSense

Hi @reuksv Do you require further assistance with this case, please? Thanks!

MartyG-RealSense avatar Jul 18 '24 10:07 MartyG-RealSense

Thank you. I think hardware reset should help, but I managed to test it only in the realsense viewer interface. You can close the ticket.

reuksv avatar Jul 18 '24 14:07 reuksv

As you suggested, I will close the issue. Thanks very much for the update!

MartyG-RealSense avatar Jul 18 '24 15:07 MartyG-RealSense