Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sails crashes if Redis goes down #2276

Closed
Chuwiey opened this issue Oct 1, 2014 · 2 comments
Closed

Sails crashes if Redis goes down #2276

Chuwiey opened this issue Oct 1, 2014 · 2 comments

Comments

@Chuwiey
Copy link
Contributor

Chuwiey commented Oct 1, 2014

Hello,

If I set the session and socket stores (or one of them) to use Redis as the adapter, and Redis goes down (for whatever reason), sails has an un-handled exception and crashes. It's actually really easy to fix this and make Sails display a 500 page while Redis is down, and then when it comes back up, just re-connect.

I am doing the work for this and will submit a pr, but have two questions:

  1. I can't find the place in the code where a request is routed through the session store so that I can respond with a 500 instead of going to an already shutdown Redis client which throws the error: Unable to parse HTTP body- error occurred :: 'Redis connection gone from close event.' - can anyone point me to it?

  2. I was thinking about auto-switching to memory adapter while redis is down, and then putting the adapter back to redis when it came back online. What are the thoughts around this? The biggest caveat is that it makes life difficult around clusters, because sessions would not be shared...

Steps to reproduce current bug:

  1. Make sure you have configured Redis as the session store (and the socket store)
  2. sails lift (while redis is running)
  3. go to a page on your app, or any route that works - it works
  4. now shutdown redis
  5. sails has crashed

Thanks!

@Chuwiey
Copy link
Contributor Author

Chuwiey commented Oct 1, 2014

Proposed fix:
#2277

@Chuwiey Chuwiey mentioned this issue Oct 1, 2014
@sgress454
Copy link
Member

@Chuwiey thanks for this--taking a look at the issue and your resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants