STM32F417 USB stop communicating
they use to be some bugs in the cdc i/f that coud hangs the com but those got fixed a while ago.
they are possible races condition between rx and tx if you handle them outside the interrupt handler context that can lead to strange issue. that is because ST midleware and HAL not proplery locking and disbaling interrupt to acess the usb ll.
if you’r using rtos such issue come even more easily.
I myslef faces lock-up using teraterm and other terminal emulator when mixing and doing concurent rx/tx (f4 h/w) .
You may have data and pointer corruption timing issues on added code causing trouble to the cdc side
could you share the cdc i/f code part where you hanlding new rx packet and where you do the tx ?