Rails public files only showing with cookie on Heroku - ruby-on-rails

Recently I've run into the issue that the public files of a rails application only load if there is a cookie present. I originally noticed this because Google reported that it couldn't find our robots.txt file. Later I realized that it seems to apply to all of our public files for some reason.
For instance, upon visiting this site, the content is blank. http://80000hours.org/robots.txt
(If it's not blank, remove the cookies from the website).
However, when I load the main page at http://80000hours.org/, and then go back to /robots.txt, the page loads correctly.
I'm quite confused what could create this issue and how to go upon debugging it. Looking back on my commits it doesn't seem like I changed anything substantial during the period where it broke. The Memcache add-on for the website shut down around a week before this happened; I never set up a replacement, but wouldn't think this would have caused the issue.
The issue also does not exist locally, only on the production and staging Heroku instances. The full codebase is here, the issue occurred around November 14th.
Any advice is much appreciated.

Sure enough, it was Memcache. I added the new Heroku Memcache add-on service, Memcachier, and it worked fine without the cookie. I'll check tomorrow if Google successfully find the /robots.txt file or not, but I'm assuming it will.

Related

Images disappear on refresh in heroku-hosted rails application

Let me say first that I'm quite new and inexperienced with rails. Today I tried to update an image in a rails app hosted on Heroku. Anyway, this is the simple flow I followed as I did other times before:
Add updated image to the image folder
Precompile the assets rake assets:precompile
Add and commit all changes
Push to heroku
Until this point all seems fine: I open Chrome to check my app from my domain and it's all there as expected.
The problem is that if I refresh the page all the images disappear (like they have never been loaded). This does not happen locally.
If I do a ctrl+f5 it all comes back nicely, but I lose everything again on simple refresh.. and so on.
Has anyone experienced something similar? I understand this might be hard to answer as there is not much code to show. Let me know if I can give more details.
On a final note, it seems that all works normally on a friends machine (that is, refresh doesn't give this problem). I'm thinking something might be wrong with my Chrome settings here? I don't remember having changed anything recently though.
This is very weird and quite annoying some help/insights would be great.
UPDATE: This seems indeed really to happen locally on my machine at work. I checked from another couple of computers at home and the app is displayed fine (without any refreshing problem).
Did you check if the cookie is disabled by your browser for the heroku website in particular?
I have just tested this issue with an image based website (https://unsplash.com/). When the cookie is disabled for that website, pressing F5 clears all the images, while pressing Ctrl-F5 brings those lost resources back as like as your case.
Enabling cookie resolves the issue in my case.

Scheduled publication not working in Umbraco

I am using Umbraco 7.5.2, installed on a VM in Azure.
When a Publish At date is set, the page is never published. I have tried the following steps.
Create and publish a page
Unpublish the page
Set the Publish At date to a few minutes in the future and Save&Publish
Verified page is definitely not visible
Wait for the time to roll around, and even a few minutes more
Page is never published.
The following message appears in the logs on save when setting the publish at date, which is normal. But no other messages appear after and the page is never published.
2016-10-25 17:46:20,784 [P4808/D10/T21] INFO Umbraco.Core.Services.ContentService - Content 'Video1' with Id '1312' is awaiting release and could not be published.
I've made a copy of my production Umbraco folder and of the database ON THE SAME VM. That instance works for scheduled publishing.
I'm wondering if anyone can provide some clues as to what the issue could be or where I could look. I'd like to avoid having to migrate my production data to this test site.
Thanks
The problem may be related with different time-zone on azure VM as Umbraco is using server time to proceed inside the code execution. This should be the first thing to check.
In version 7.6.0 (https://our.umbraco.org/contribute/releases/760) it will be possible to set up server timezone and then set up a time with precise offset, so those type of problems shouldn't be seen then.
For me it was a wrong umbracoApplicationUrl path (it has to point to YOURDOMAIN/umbraco) After fixing this url everything started working fine
In addition to Marcin's answer, also check that the server can access itself, as it pings itself to fire the scheduled publishing. If it can't resolve it's own address, the scheduled publish will fail. It doesn't happen often, but I've seen a few VERY locked down installs where the server can't resolve it's own address.

localhost:3000 won't update after saving changes in sublime

I'm new to programming and trying to make changes to a Rails app. I downloaded a forked repo from Github and got it up and running on my local computer after running rake db:migrate (originally got error messages).
I've since made changes to a few HTML files (minor - changed text of a few sentences) in Sublime and saved, but they aren't reflected in browser.
I refreshed the browser and tried restarting the server. I must be missing steps. Any help appreciated, thank you.
There are a few things that could be happening. Most likely, you are getting some browser cache( but you could be getting a network, web server cache as well)
Try reloading the page with ctrl + r ( or cmd + r if you don't like real nix)
Next you could try loading in an incognito window to see if it's a session level issue.
Next you can try restarting your server. In general in development environment there shouldn't a cache set up but maybe you are hitting an issue there.
In my dev config, I have all the caching off. In my dev browser I have all the dns/browser caches disabled.
At the end of the day, you could be modifying the wrong file. Try ack'ing or grepping to see if there are other occurrences of that text in other files. Often there will be multiple header partials or multiple layouts that are similar but not really.

Grails withForm and AWS interactions

The following issue is using the following:
AWS
PostgreSQL
Grails 2.3.3
Redis
On our account creation page, we are having some REALLY obscure functionality with the Grails withForm{}.invalidToken{} closure.
Upon hitting the page for the first time, everything works fine. You can post back to the server fine as long as you do not leave this page.
Upon leaving this page, either through navigation links or logging off, returning to the page (Again through navigation links or logging on and heading there), we can no longer submit, it hits the invalidToken closure every time.
I know AWS is involved as we took the project and deployed it to local machines both with IntelliJ and Tomcat by itself and both work fine. This issue only occurs upon deploying the WAR to AWS. (This occurs both with local builds and automated builds. They work locally but not on AWS)
We have spent almost a week on this issue trying to figure out why this is occuring, and all we have to show for it is we know AWS is somehow involved, but that's as far as we have gotten.
Does anyone have any insight into what would be causing our session to act like this?
After a LOT of searching about this issue, me and my team finally figured it out. Taken directly from our JIRA:
"This issue is caused by the implementation of tomcat-redis-session-manager used on AWS. As per their documentation (https://github.com/jcoleman/tomcat-redis-session-manager#session-change-tracking), there are "unintended consequence of hiding writes if you implicitly change a key in the session or if the object's equality does not change even though the key is updated." Specifically, the "useToken" implementation is Grails 2.3.8 is: "String generateToken(String url) { final UUID uuid = UUID.randomUUID() getTokens(url).add(uuid) return uuid }" The combination of these native implementations are there for incompatible.
The tomcat-redis-session-manager does support a manual dirty tracking mode by setting: RedisSession.setManualDirtyTrackingSupportEnabled(true); but this would require a forked build of SynchronizerTokensHolder in grails-core."

.NET MVC Slow Site

I have a site that is taking around 20 seconds to load every page (no matter what it does)
So i put in a /scripts/test.html that isn't part of a route and it still takes this long... no db hit nothing.
I renamed the web.config to _web.config and it loads instantly, rename it back... back to around 20-30 second load times.
Running the application locally... i put a breakpoint on the RegisterRoutes in the Global.asax.cs and ran that... /scripts/test.html does not hit breakpoint normal site does (site loads instaly fast locally on the same database/code)
Server is Mosso IIS7/SQL Server 2008 Cluster
The site is being hit pretty hard... ANY help please? or things to test/debug?
Few things to try:
Try taking a look with FileMon/ProcessMonitor and see if there is a ton of disk activity.
If the above is not an issue, install an instance of Dot Trace by Jet Brains. Profile the app and see if there is some memory or performance issue that is not apparent on your local box.
I saw another related issue that was solved by disabling IPv6, maybe try that.

Resources