Missing data from queue when tried to pop from different task

Hi,

I am facing a problem with queue. I have two task and each starts simultaneously using fork.
In one task I am pushing the data into the queue while in another task i am waiting of posedge clock and popin the data. I see one data is missing in doing that,that is 2 packet out of 5 packets. Is that Data is missing or overwritten.
Can any one help in this.

Sceanrio:

class eth_monitor extend uvm_monitor;
 virtual scb_interface  scb_if;

 ax_eth_item   eth_q[$],rx_item;
 event rcv_start;
`uvm_componenet_utils(eth_monitor)
 
task receive();
  forever begin
    fork
      begin
        receive_method(rx_item)
          eth_q.push_back(rx_item);
          ->rcv_start;
       end
       send_to_scb();
     join_none
  end
 endtask:receive

task send_to_scb();
 ax_eth_item scb_item;
  @rcv_start;
  forever begin
    scb_item = ax_eth_item::type_id::create("scb_item");
    @posedge sc_if.clk;
    scb_item = eth_q.pop_front();
     // problem here when dispalyed i see only 4 packets instead of 5 packets,missing     // is second packet
  end

task main_phase();
receive();
endtask:main_phase
endtask:send_to_scb

I think you may be missing a rx_item.clone() somewhere, but you do not show enough code.

One thing that seems strange is you create an scb_item, but then it gets destroyed when you do the pop_front().

In reply to dave_59:

Thanks Dave,

It worked, I used the below code
$cast(rx_item_clone,rx_item.clone());

Regarding the one that you have mentioned, scb_item, the intention is create a new empty item on every posedge clock since its forever loop and assign the real Data item while pop_front() and use the item to send to the scoreboard and destroy it.

BR,
Antony

In reply to mp.antonyraj:

Thanks Dave,

It worked, I used the below code
$cast(rx_item_clone,rx_item.clone());

Regarding the one that you have mentioned, scb_item, the intention is create a new empty item on every posedge clock since its forever loop and assign the real Data item while pop_front() and use the item to send to the scoreboard and destroy it.

BR,
Antony