Peculiar issue in queue

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