Set_rx_gain during continuous streaming

I’m starting continuous streaming and then in a loop I call recv() and
set_rx_gain (I’m trying to implement SW AGC).

The problem is that the set gain command cause problem with the recv (a
lot of samples are lost) and I get a lot of “O” prints.

I’m using the newest UHD build & FW / FPGA (version 9).
This behaviour happens both on USRP N210 with DBSRX2 and USRP2 with

On previous UHD build it did work (I dont remember the exact build).

I’ll be happy to get some help solving this issue (or if you have any
other ideas regarding the AGC I’ll be happy to hear)