For a few hours I could not login on frontend. (on local domain https://www.magento2.loc, magento 2.2.5, developer mode). If I enter wrong username or password, yes, I receive error message. With correct credentials it just reloaded the login page, that's all. Googling around did not help. I tried all possible settings with cookies and sessions, cleared generated, cache and sessions directories, disabled all modules in app/code and switched to blank theme. The backend, by the way, worked normally. I could log in and out to the dashboard.
The problem was solved by itself when I restarted the computer (MAC, El Capitan) and crossed my fingers.
The question is what could it be? And how to prevent it in production environment?