# 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.

**URL:** https://discourse.vtk.org/t/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/8977
**Category:** Support
**Created:** [July 20, 2022, 8:52am UTC](https://discourse.vtk.org/t/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/8977 "2022-07-20T08:52:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![guptaaarju](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e274bd/32.png) [@guptaaarju](https://discourse.vtk.org/u/guptaaarju)
#### Post date: [July 20, 2022, 8:52am UTC](https://discourse.vtk.org/t/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/8977/1 "2022-07-20T08:52:16Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [July 21, 2022, 3:59am UTC](https://discourse.vtk.org/t/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/8977/2 "2022-07-21T03:59:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![guptaaarju](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e274bd/32.png) [@guptaaarju](https://discourse.vtk.org/u/guptaaarju)
#### Post date: [July 21, 2022, 4:39am UTC](https://discourse.vtk.org/t/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/8977/3 "2022-07-21T04:39:00Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [July 21, 2022, 12:14pm UTC](https://discourse.vtk.org/t/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/8977/4 "2022-07-21T12:14:00Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![guptaaarju](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e274bd/32.png) [@guptaaarju](https://discourse.vtk.org/u/guptaaarju)
#### Post date: [July 22, 2022, 3:15am UTC](https://discourse.vtk.org/t/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/8977/5 "2022-07-22T03:15:02Z")

</div>

#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();

```

}

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [July 22, 2022, 2:29pm UTC](https://discourse.vtk.org/t/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/8977/6 "2022-07-22T14:29:39Z")

</div>

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.
