How to prevent transaction creation inside sequence from using same handle?

Hi there,

Is there any good way to assert/enforce sequence creates new object when sending to sequencer?

background:
When supporting in-house uvm vip, I often receive request from other users stating seeing issues with vip. Most time it turned out it’s user’s sequence problem where transaction is not being created each loop or same transaction handle is being used in multi-thread statement to create parallel RW scenario. And such usage will definitely mess up driver.
One way I can think of is to do deep copy upon receive transaction from SQR, but this seems expensive.

I’m curious is there any effective checks/assertions can be done to find these issues easier?

Thanks in advance.

In reply to Jianfeng_0:

You can compare the value of the handle with the previous transaction. If they did not create a new object, you can issue an error.

In reply to dave_59:

Hi Dave,

I’ve thought about it. Thank you.
For this particular scenario below, how can it be improved from drirve’s point of view?
issue with the code is when one thread blocked on finish_item(), the other thread will change the content of tr.

seqeuence:

my_trans tr;
fork 
  begin: read
    tr = new();
    start_item(tr);
    tr.randomize() with {op == read};
    finish_item(tr);
  end
  begin: read
    tr = new();
    start_item(tr);
    tr.randomize()with {op == write};
    finish_item(tr);
  end
join