I am trying to regularly update the scene based off this tutorial:
However even when it just prints while it runs fine for a few minutes it always ends up giving me the error
OSError:Errno22 Invalid argument
I tried making argument for on_update optional, ie giving it a default value, and the same thing happened. The only way to get things to work again is to restart omniverse code.
Any advice on why it might be crashing with an invalid argument error after a few minutes of working fine?
Hi @paz.zait-givon. I believe this happens on hot-reload if you are not unsubscribing correctly. Make sure you are clearing your subscriptions before or during the extension
Thank you @mati-nvidia . I wasn’t unsubscribing at all. I tried to remedy that with unsubscribing in on_shutdown.
Unfortunately the problem seems to persist. I dont change the code at all while it is running for these tests.
Am I just unsubscribing in the wrong way? At the wrong time?
Below is the simplified code.
update_stream = omni.kit.app.get_app().get_update_event_stream()
def on_startup(self, ext_id):
self.stage = omni.usd.get_context().get_stage()
self._count = 0
self.start_time = datetime.now()
def on_update( e: carb.events.IEvent = None):#,ext_id, e: carb.events.IEvent):
print(f" now is "+str(datetime.now())+" or "+ str(datetime.now()-start_time)+" from start time" )
sub = update_stream.create_subscription_to_pop(on_update, name="My Subscription Name")
print(" MyExtension shutdown")
Hi @paz.zait-givon. Thanks for reporting this. This internal issue is tracking it: OM-48118.
As a workaround, I think you can use
It works effectively the same, but I wasn’t able to reproduce the error with it.