It should cancel in 24-48 hours if it doesnt go through, but if a node re-broadcasts it accidentally or maliciously, then it can be stuck FOREVER. I have had my TX stuck for 48 hours, and then some jackass rebroadcasted it, and it was in limbo for more than 72 hours, before I figured out this method and successfully recovered my money with a double spend.
So this is a last resort procedure to recover your money.