Skip to content

反复创建关闭不共享场景的两个Vis,会导致程序崩溃 #11

@qqfly

Description

@qqfly

反复创建、关闭不共享场景的Vis,会造成程序崩溃,具体复现场景和错误信息如下:

复现场景1

from RVBUST import Vis
import time
def TestOnce():
    v1 = Vis.View("abc", shared=False)
    v1.Sphere(center=[0, 0, 0], radius=0.3)

    time.sleep(1)
    v1.Close()
    return True

v2 = Vis.View("RobotVis")
for i in range(100):
    TestOnce()

错误信息:

double free or corruption (out)
Aborted

复现场景2

from RVBUST import Vis
import time

class Plotter():
    def __init__(self, name, shared=False):
        self.m_view = Vis.View(name, shared)

    def PlotSphere(self, radius):
        self.m_view.Sphere(center=[0, 0, 0], radius=radius)

    def ClearVis(self):
        self.m_view.Clear()

    def CloseVis(self):
        self.m_view.Close()

def TestOnce(shared):
    plotter = Plotter("abc", shared)
    plotter.PlotSphere(radius=0.3)
    time.sleep(1)
    plotter.ClearVis()
    plotter.CloseVis()
    return True

if __name__ == "__main__":
    v2 = Vis.View("RobotVis")

    for i in range(100):
        TestOnce(False)

错误信息为:

[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python3: ../../src/xcb_io.c:263: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted

但是存在以下两种情况,连续运行100次,未发生崩溃:

  1. shared=True;
  2. 不在函数中构造另一个Vis,代码如下:
from RVBUST import Vis
import time

v2 = Vis.View("RobotVis")
for i in range(100):
    v1 = Vis.View("abc", shared=False)
    v1.Sphere(center=[0, 0, 0], radius=0.3)

    time.sleep(1)
    v1.Close()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions