Commit 5f511dee by Daniel Lee

middleware: recover and retry on session start

Partial fix for #11155 - the Macaron session middleware
panics if mysql returns an error. This fix recovers from
the panic and retries once
parent 9cae6f05
......@@ -105,6 +105,18 @@ type SessionWrapper struct {
}
func (s *SessionWrapper) Start(c *macaron.Context) error {
// See https://github.com/grafana/grafana/issues/11155 for details on why
// a recover and retry is needed
defer func() error {
if err := recover(); err != nil {
var retryErr error
s.session, retryErr = s.manager.Start(c)
return retryErr
}
return nil
}()
var err error
s.session, err = s.manager.Start(c)
return err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment