Omniverse apps crashing when invoking HTTP requests in behavior scripts

Hi all,

I’ve tried to invoke some simple HTTP requests from behavior scripts in Omniverse application (tried Create 2022.3.3 and Isaac Sim 2022.2.0) and the result is the crash of the application.

I tried using:

  • request
  • urllib3
  • request with asyncio

In every scenario the result was the crash, so I think it’s a bug or I am missing something.

Thank you so much for your support.

Hi @giustino.esposito. I have it a try and I wasn’t able to reproduce the crash. He’s a simple example based on the one you shared with me on Discord:

import requests
from omni.kit.viewport.utility import get_active_viewport_window
import omni.ui as ui
from omni.kit.scripting import BehaviorScript


class NewScript(BehaviorScript):
    def on_init(self):
        print(f"{__class__.__name__}.on_init()->{self.prim_path}")
        self.viewport_window = get_active_viewport_window()
        self.frame= self.viewport_window.get_frame("Super Duper Cool!")

    def on_destroy(self):
        print(f"{__class__.__name__}.on_destroy()->{self.prim_path}")

    def test(self):
        print("Hello")
        a = requests.get("https://google.com")
        print(a.content)

    def on_play(self):
        print(f"{__class__.__name__}.on_play()->{self.prim_path}")
        a = requests.get("https://google.com")
        print(a.content)
        with self.frame:
            with ui.Placer(offset_x=10,offset_y=50):
                with ui.ZStack():
                    with ui.HStack():
                        ui.Button("Test",width=50,height=50, clicked_fn=self.test)
        

    def on_pause(self):
        print(f"{__class__.__name__}.on_pause()->{self.prim_path}")

    def on_stop(self):
        print(f"{__class__.__name__}.on_stop()->{self.prim_path}")
        self.frame.destroy()

    def on_update(self, current_time: float, delta_time: float):
        # print(f"{__class__.__name__}.on_update(current_time={current_time}, delta_time={delta_time})->{self.prim_path}")
        pass

Does this one work for you? I didn’t see you deleting the UI in your example. Not that I destroy the frame in the on_stop() maybe that was it?

Hi Mati,

thank you so much for your reply. I will try your code to check if it crashes, one thing I probably didn’t tell you is that the API I am calling is exposed by an extension active on the same Omniverse instance. So the request call is to Omniverse port as “http:127.0.0.1/8111”, probably could be this the problem.

Hi @giustino.esposito. Did you have any update on your end? Did my repro work? Do you have some other simple repro I could try? Another way we could go about it is that you can reproduce it and share you crash logs: How to Report an issue with Omniverse