Maximum number of clients reachedERROR: In /home/aarju/VTK-7.1.1/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 1497 vtkXOpenGLRenderWindow (0x555dac8b7280): bad X server connection. DISPLAY=:0. Aborting.

Hi, I’m using VTK with QT.
After running 215 frames of point cloud data, My program is crashing and getting this error.

Maximum number of clients reachedERROR: In /home/aarju/VTK-7.1.1/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 1497
vtkXOpenGLRenderWindow (0x555dac8b7280): bad X server connection. DISPLAY=:0. Aborting.

If you know please leave the comment, Its very urgent.

This looks more like a graphics driver issue to me. Did you try updating your driver and restarting the machine? If so, more specifics like code snippets, screenshots, etc. would help understand your use case.

Simply I am using it my local machine ubuntu 20.04 and visualise the code.
Code successfully run till 200 frames then crash it

@guptaaarju It is also possible that your program is leaking memory and running out of GPU memory. If you need a more insightful response, you’d have to provide more details.

#include <vtkRenderWindow.h>
typedef pcl::PointXYZI PointT;
typedef pcl::PointCloud PointCloudT;
PointCloudT::Ptr input_cloud;
pcl::visualization::PCLVisualizer::Ptr viewer_3D;
The code is:
/Reading LIDAR DATA( bin file format) functionality/
void MainWindow::ReadInputFile(const std::string& CSV_File)
{

PointT point;
std::vector<float>row;
std::vector<float>rows;
std::string line, word;
/*Reset the Point Cloud container value*/
input_cloud.reset (new PointCloudT);

// viewer_3D->removeAllPointClouds ();
// viewer_3D->removeAllShapes();
// viewer_3D->removeCoordinateSystem();
// viewer_3D->close();
viewer_3D.reset (new pcl::visualization::PCLVisualizer (“viewer_3D”, false));

/*Reading Input file*/
fstream file (CSV_File.c_str(), ios::in);
getline(file,line);//For Heading Removing

while((getline(file, line)))//Row by Row interpreation
{
    int count=0;
    std::stringstream str(line);
    while(getline(str, word, ','))
    {
        if(count<=2||count==6)
        {
            float value =stof(word);
            row.push_back(value);


            if(count==6)
            {


                break;
            }

        }
        count++;
    }
    point.x=row[0];
    point.y=row[1];
    point.z=row[2];
    point.intensity=row[3];
    input_cloud->push_back(point);

    row.clear();

}

/*Displaying Lidar Point on Display Window*/

ui->PCD_Viewer->SetRenderWindow(viewer_3D->getRenderWindow());
viewer_3D->addPointCloud<PointT>(input_cloud, "input_cloud");
ui->PCD_Viewer->update ();
input_cloud->clear();

}

It is a little hard to read with the code formatting broken like that. But, can you make sure that you are on the latest vtk version. And also, that addPointCloud is not adding new data each frame. Because that will quickly fill up GPU memory.