Concurrent calls to get_next_item() not supported. Consider using a semaphore to ensure that concurrent processes take turns in the driver

Hi,
I’m trying to send some items on different sequencers parallelly, and I getting this error from the sequencer:

"UVM_FATAL @ 2183595: uvm_test_top.env.TX_DATA.noc_nsip_vc_sequencer [uvm_test_top.env.TX_DATA.noc_nsip_vc_sequencer] Concurrent calls to get_next_item() not supported. Consider using a semaphore to ensure that concurrent processes take turns in the driver "

Here my code:

class nap_random_nsip_seq extends nap_base_seq;
  
  nsip_vc_uvm_common_pkg::nsip_vc_command_item nsip_item;
  uvm_sequencer_base noc_sequencers_list[string];

  `uvm_object_utils_begin(nap_random_nsip_seq)
  `uvm_object_utils_end
  `uvm_declare_p_sequencer(sla_pkg::slu_sequencer)

  task send_on_all_nsip_sequencers();
    string nsip_vc_names[] = {"TX_REQ","TX_RSP","TX_DATA"};
    foreach(nsip_vc_names[index]) begin
      automatic string name = nsip_vc_names[index];
      noc_sequencers_list[name] = slu_sequencer::pick_sequencer(name);
      fork
        send_random_noc_transactions(name);
      join_none
    end
    wait fork;
  endtask : send_on_all_nsip_sequencers

  task send_random_noc_transactions(string name);
    
    uvm_sequencer_base seqr = noc_sequencers_list[name];
    `uvm_create_on(nsip_item, seqr);
    nsip_item.randomize() with {
      valid == 1;
    };
    `uvm_send(nsip_item);
  endtask

endclass

But, I found that in case nsip_item declared in the task “send_random_noc_transactions” scope, instead of in class scope, the code work as expected, I don’t get the error and the sequencers send the items parallelly.

I have no idea on why this error is happening, and why this is the solution.

Kindly please help me in this regard

In reply to shay.moskovitz:

Your use of `uvm_send is hiding the fact that nsip_item gets overwritten by each concurrent call to send_random_noc_transactions while waiting for the sequencer to start the item. Declaring nsip_item inside the task gives each call a local copy.

We suggest using the native API using start_item()/finish_item which makes what is happening much clearer: Sequences/API | Verification Academy

OVM-UVM Macros-Costs vs Benefits DVCon11 Appnote (PDF)