Search code examples
ruby-on-railsrubyunicorn

Rails with unicorn showing 2 different version of same page


I have a rails 4.1 app that is using nginx and unicorn.

Lets say I make a change to html of a page and push it live. If I navigate to that page or refresh it, I randomly get either the old page or the new updates.

This happens with assets as well. For example refreshing a page will get me either the old version of my css file or the newest version. Obviously this causes a ton of issues.

I am using the default asset pipeline.

I've tried running rake:tmp:clear. I've tried using Rails.tmp.clear from Rails production console. Neither have worked.

This is a really strange issue that I can't seem to get my head around.


Solution

  • Check out the pid of your unicorn with ps au | grep unicorn, it may freeze after update. If afrer kill -USR2 unicorn pid is the same you should restart unicorn hard with kill -9 unicorn and run it back or run deploy script again.