The root of the problem is that Yahoo's mail servers are garbage. They routinely get 'out of sync' with each other, making logging in difficult or impossible until they resolve the problem on their end or until you randomly manage to connect to a server that's not borked out of the hundreds of mail servers they have.
Complain to Yahoo. Or, better yet, switch to another email provider.