Calling on_update gives OSError:Errno22 Invalid argument


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?

Thank you

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 on_shutdown()

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 =

class MyExtension(omni.ext.IExt):

def on_startup(self, ext_id):
    print("MyExtension startup")
    self.stage = omni.usd.get_context().get_stage()
    self._count = 0
    self.start_time =  

def on_update( e: = None):#,ext_id, e:
    print(f" now is "+str(" or "+ str(" from start time"  )
sub = update_stream.create_subscription_to_pop(on_update, name="My Subscription Name")

def on_shutdown(self):
    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 carb.log_info

import carb

carb.log_info("Hello World!")

It works effectively the same, but I wasn’t able to reproduce the error with it.