Hello everybody
What datasource I’m using?
Microsoft SQL Server
What OS are you running grafana on?
RedHat 7
What happened ?
I have two dashboard who show graphs and refresh automatically every 30 seconds. The dashboard display graphs for 12 hour. But Grafana log me out randomly without timeout delay.
The message log of my error :
failed to look up user based on cookie" logger=context error="user token not found
Thank you for your assistance
If you are using Grafana version 6 then there is already an open issue looking at this (or a similar) problem.
opened 05:30AM - 25 Apr 19 UTC
closed 02:32PM - 01 May 19 UTC
type/bug
area/auth
**What happened**:
Kiosk user session automatically logs out on auto-refresh
…
**What you expected to happen**:
Kiosk user stays logged in for max duration (30 days default)
**How to reproduce it (as minimally and precisely as possible)**:
This is an edge case that is hard to reproduce. A client logged in can have its cookie/auth rotated but not receive the new session.
**Environment**:
- Grafana version:
6.1.3
- Data source type & version:
Any datasource, problem reported with a Zabbix datasource. Test datasource can also do this as long as the dashboard has an auto-refresh.
- OS Grafana is installed on:
linux/docker
- User OS & Browser:
linux/chrome
DETAILS:
This edge case occurs when the auth_token is rotated but the client does not receive the updated token.
Looks like it can happen at https://github.com/grafana/grafana/blob/67cbc7d4cf135c3ed2fa5a47278c6be6e7653e7f/pkg/middleware/middleware.go#L193
the function TryRotateToken can succeed, updating the database with the new token, but fail to send the new session cookie at line 200
There should be error handling to detect when WriteSessionCookie fails, and to roll back the auth token to previous so it can be refreshed again by the client.
When this happens, the client reconnects with the old token, and is logged out since it is no longer valid.
See also https://localhost:3000/t/after-upgrade-from-grafana-5-to-6-dashboard-keeps-logging-out/14931