I had this issue at one time. It turned out to be a weak barrel nut retainer spring. Compared to a "new" spring in a SMG parts kit, the one that came with my gun was noticeably shorter. I swapped them out and all was well.
As noted, chipped / worn teeth on the barrel nut or catch could lead to this as well. Again, you should be able to see if this is the case, and swap out inexpensive parts as needed.
My trunnion welds broke a few years ago. It did not stop running until the trunnion had moved forward far enough that the bolt started deforming the receiver. You should see a gap between the trunnion flange and the front of the receiver if this is happening.