[Possible Bug] Omniverse's package omni.kit.xr.scene_view.utils.UiContainer Descriptor pool allocations max count

There appears to be a limit on the number of <100 Omniverse lifecycle UiContainers are allowed within Omniverse due to “Descriptor pool allocations max count”.

Error and eventual crash:

Code to produce error is below. All it does it create 100 UiContainers with a rectangle and a label within each of them when a custom extension starts. On the 100th creation it throws the error.

What is significant about this is that when the extension is enabled and reenabled this 100 limit is not reset meaning each time an extension is cycled on/off it adds to the descriptor pool without removing any.

If your extension creates 10 UiContainers during it’s lifecycle and a user enabled and disables the extension 10 times they will get the same error and eventually lag/crash Omniverse.

Running latest kit app template
Omniverse version: 106.5

Code to produce error
import omni.ext
import omni.ui as ui
import carb
from omni.ui import color as cl
from omni.kit.xr.scene_view.utils import UiContainer, WidgetComponent
from typing import Dict


NUMBER_OF_WORLDSPACE_UI = 100

class WorldFrame(ui.Widget):
    """Small class that defines a label with a background rect

    Args:
        ui (_type_): ui.Widget
    """
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self._ui_label = None
        self._build_ui()

    def _build_ui(self):
        with ui.ZStack():
            ui.Rectangle(style={"Rectangle": {"background_color": cl("#000000FF")}})
            self._ui_label = ui.Label("Display Time", style={"Label": {"font_size": 25, "alignment": ui.Alignment.CENTER_TOP,}})

class Extension(omni.ext.IExt):
    """This extension manages creating the loading and stage
    messaging managers"""
    def on_startup(self, _ext_id: str):
        """This is called every time the extension is activated."""
        self._labels:Dict[str, UiContainer] = {}
        for i in range(NUMBER_OF_WORLDSPACE_UI):
            parented_widget_component = WidgetComponent(
                WorldFrame,
                width=200,
                height=200,
                resolution_scale=5,
                unit_to_pixel_scale=1,
            )
            self._labels[f"{i}"] = UiContainer(parented_widget_component)

    def on_shutdown(self):
        """This is called every time the extension is deactivated. It is used to
        clean up the extension state."""
        for label in self._labels.values():
            if label:
                label = None
        self._labels.clear()
1 Like

Thanks for this very interesting post. I checked with the engineers and we are actually aware of this limitation and we are in the process of addressing it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.