From what I understand, when you start mining, there is a counter that, when it reaches a certain time, ore will be deposited in your inventory.
Also, when you're standing close to a NPC, a timer will start, when it reaches a certain time, he will say something to you. This timer is reset and restart after he says something, so he will say something else again, forever.
It seems that the amount of time needed for the NPC to say something is lower than the time needed for the ore to be deposited in your inventory and it seems that the NPC's dialogue will reset the mining timer back to zero.
The result of this is that, if you're mining with a NPC close enough to talk to you, your character will be doing the mining animation forever without any results, until you stop it manually and make sure to restart further away from the NPC.
This only happened once since I haven't found the conditions to reproduce the problem again, in the last time I played.