Peculiar issue in queue

I am facing a very peculiar issue in scoreboard.
The monitor sends multiple transactions to the scoreboard and these are buffered before getting processed.

I realized that the data that is popped out of the scoreboard seemed incorrect.
So, I have put uvm debug message to check what is getting into queue every time a transaction is written to the queue.
So, essentially, every time a transaction is pushed into the queue, i iterate through the entire queue and print.
What I see is that the entire queue always contains latest transactions only.

For example,
1 transaction write - push value 1; print displays 1
2 transaction write - push value 2; print displays 2 2
3 transaction write - push value 3; print displays 3 3 3

I have checked the monitor that sends the transaction. It creates new objects before transactions and then calls write method of scoreboard.

Any inputs would be highly appreciated.

PS: I don’t have a small example to demonstrate it currently. I am working on it.

In reply to verif_learner:

It seems like you are on the right path to find the problem. Without any other code to show, no one can help you further.

In reply to verif_learner:
It looks like you do not store a copy of your seq_item. Please check for this.

In reply to dave_59:

I have tried the same concept using the following example. This one works fine though.
I will keep trying some variants of this example to see if I can reproduce the issue I am seeing but any hints is highly appreciated.

module x;
  
  class transt;
    int a,b;
  endclass
  
  class consumer;
    transt c1_q[$];
    function enqueue (transt item);
      c1_q.push_back(item);
      
      for (int idx = 0; idx < c1_q.size; idx++) begin
        $display ("a %d b %d", c1_q[idx].a, c1_q[idx].b);
      end
    endfunction
  endclass

  
  class producer;
    task producer_thread (consumer c1_inst);
      transt t1_inst;
      for (int idx = 0; idx < 10; idx++) begin
        t1_inst = new;
        t1_inst.a = idx;
        t1_inst.b = idx*2;
        c1_inst.enqueue(t1_inst);
        #10ns;
      end
    endtask
  endclass
  initial begin
    producer p1 = new;
    consumer c1 = new;
    
    #100ns;
    p1.producer_thread (c1);
    
    #10ns;
    $finish;
  end
endmodule

Output:

a 0 b 0
a 0 b 0
a 1 b 2
a 0 b 0
a 1 b 2
a 2 b 4
a 0 b 0
a 1 b 2
a 2 b 4
a 3 b 6
a 0 b 0
a 1 b 2
a 2 b 4
a 3 b 6
a 4 b 8
a 0 b 0
a 1 b 2
a 2 b 4
a 3 b 6
a 4 b 8
a 5 b 10
a 0 b 0
a 1 b 2
a 2 b 4
a 3 b 6
a 4 b 8
a 5 b 10
a 6 b 12

In reply to chr_sue:

In reply to verif_learner:
It looks like you do not store a copy of your seq_item. Please check for this.

The producer (that is monitor in this case), creates new objects, populates the contents and then calls ap.write(transaction). The consumer (scoreboard in this case), simply puts the object in its internal queue. This is the reason I don’t make a copy of transaction in the scoreboard.