Replicator writer inconsistently writing on step

I’m trying to modify a scene, schedule a write, and then step and write the rendered images. However, it seems that when I call orchestrator.step_async, despite my having just scheduled my writer to write, the writer sometimes just doesn’t write. Only when I next step does the writer write the previous frame’s data. Does anyone know what could be going on here?

How are you calling step_async? Are you awaiting it properly? Are you setting any subframes? Also, is your writer properly initialized before calling step_async?

For example, this snippet demonstrates proper initialization and usage of step_async with a writer:

import asyncio
import omni.replicator.core as rep

async def run_example_async():
    # Initialize the stage and create objects
    omni.usd.get_context().new_stage()
    rep.create.cube()
    rep.create.light()
    rp = rep.create.render_product("/OmniverseKit_Persp", (512, 512))

    # Initialize the writer
    basic_writer = rep.WriterRegistry.get("BasicWriter")
    basic_writer.initialize(output_dir="_out_test", rgb=True)
    basic_writer.attach(rp)

    # Step and write data
    for i in range(3):
        await rep.orchestrator.step_async()
        print(f"Step {i} completed")

asyncio.ensure_future(run_example_async())