PointCloudLibrary / PointCloudLibrary/pcl
ImageViewer crashes
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 4.7k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 6
Description
When trying to display the Ensenso images I faced a bug in pcl::visualization::ImageViewer.
The images are correctly displayed until the viewer crashes after a few (~30) seconds.
Bug log
I deleted some duplicated errors to make the log shorter
Initialising nxLib
Opening Ensenso stereo camera id = 0
ERROR: In /build/buildd/vtk-5.8.0/Filtering/vtkExecutive.cxx, line 783
vtkStreamingDemandDrivenPipeline (0x7f42a02c3fe0): UpdateInformation invoked during another request. Returning failure to algorithm vtkImageFlip(0xf35d30).
ERROR: In /build/buildd/vtk-5.8.0/Filtering/vtkExecutive.cxx, line 783
vtkStreamingDemandDrivenPipeline (0x7f42a02c3fe0): UpdateInformation invoked during another request. Returning failure to algorithm vtkImageFlip(0xf35d30).
ERROR: In /build/buildd/vtk-5.8.0/Filtering/vtkExecutive.cxx, line 776
vtkStreamingDemandDrivenPipeline (0x7f42a02c3fe0): ProcessRequest invoked during another request. Returning failure to algorithm vtkImageFlip(0xf35d30) for the recursive request:
vtkInformation (0x7f42a02c5c00)
Debug: Off
Modified Time: 9758
Reference Count: 1
Registered Events: (none)
Request: REQUEST_UPDATE_EXTENT
FROM_OUTPUT_PORT: 0
FORWARD_DIRECTION: 0
ALGORITHM_BEFORE_FORWARD: 1
ERROR: In /build/buildd/vtk-5.8.0/Filtering/vtkExecutive.cxx, line 783
vtkStreamingDemandDrivenPipeline (0x7f42a02c3fe0): UpdateInformation invoked during another request. Returning failure to algorithm vtkImageFlip(0xf35d30).
ERROR: In /build/buildd/vtk-5.8.0/Filtering/vtkExecutive.cxx, line 783
vtkStreamingDemandDrivenPipeline (0x7f42a02c3fe0): UpdateInformation invoked during another request. Returning failure to algorithm vtkImageFlip(0xf35d30).
*** Error in `/home/dell/MEGAsync/Ensenso/pcl_ensenso_viewer/build/ensenso_pcl_images_viewer': corrupted double-linked list: 0x00007f42a031f870 ***
When trying the launch the program after the first crash:
[0;m[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
ensenso_pcl_images_viewer: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
Test code
#include <iostream>
#include <pcl/console/print.h>
#include <pcl/io/ensenso_grabber.h>
#include <pcl/visualization/image_viewer.h>
/** @brief Convenience typedef for the Ensenso grabber callback */
typedef std::pair<pcl::PCLImage, pcl::PCLImage> PairOfImages;
/** @brief Image viewer */
pcl::visualization::ImageViewer::Ptr image_viewer_ptr;
/** @brief A pointer to the PCL Ensenso object */
pcl::EnsensoGrabber::Ptr ensenso_ptr;
/** @brief Process and/or display Ensenso grabber images
* @param[in] images Pair of Ensenso images (raw or images with overlay)
* @warning Image type changes if a calibration pattern is discovered/lost;
* check @c images->first.encoding */
void
grabberCallback (const boost::shared_ptr<PairOfImages>& images)
{
unsigned char *l_image_array = reinterpret_cast<unsigned char *> (&images->first.data[0]);
unsigned char *r_image_array = reinterpret_cast<unsigned char *> (&images->second.data[0]);
image_viewer_ptr->addMonoImage(l_image_array, images->first.width, images->first.height);
//image_viewer_ptr->addRGBImage(r_image_array, images->second.width, images->second.height);
}
/** @brief Main function
* @return Exit status */
int
main (void)
{
image_viewer_ptr.reset (new pcl::visualization::ImageViewer);
ensenso_ptr.reset (new pcl::EnsensoGrabber);
ensenso_ptr->openTcpPort ();
ensenso_ptr->openDevice ();
ensenso_ptr->initExtrinsicCalibration (5);
boost::function<void
(const boost::shared_ptr<PairOfImages> &)> f = boost::bind (&grabberCallback, _1);
ensenso_ptr->registerCallback (f);
ensenso_ptr->start (); // Image mode! No cloud information
while (!image_viewer_ptr->wasStopped ())
image_viewer_ptr->spinOnce ();
ensenso_ptr->closeDevice ();
return (0);
}
Sorry for the very specific test code, I don't have any other frame grabber example.
I think it has to do with the grabber threading.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with pcl/visualization/image_viewer.h and pcl/io/ensenso_grabber.h, then inspect the grabberCallback and the ImageViewer spinOnce loop in the supplied test code. Reproduce the sustained display and determine whether the threading interaction causes the reported crash; done means the viewer remains running without the VTK or XCB errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100