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
Assets return 404 after ~5 minutes on dev #304
Comments
Interesting, looks like the directory gets deleted when the server is up for five minutes:
Struggling to come up with a hypothesis for this behavior... |
The plot thickens. Directory does not disappear when running |
Okay, turns out this is fallout from using EmberCLI-Rails in development with Passenger's default configuration. Specifically, "smart spawning" mode, and the preloader's timeout of five minutes. Passenger's smart spawning boots the app in a separate process (aka preloader), then subsequently forks a new worker processes off of the preloader. The benefit of this is that spinning up new worker processes is very fast, and all the worker processes get to share memory via copy-on-write. These worker processes are the ones that actually serve responses, while the preloader never does. If the preloader goes five minutes without spawning a new process, it will shut down to conserve memory. So, when a Rails app with EmberCLI-Rails boots in this default Passenger environment, the There are very easy workarounds one could employ in the Passenger configuration, like disabling smart spawning, or setting the preloader timeout to zero. However, this took me a fair bit of effort to even figure out what was going on, much less strategies for working around it, so I think it'd be nice to try to address this in EmberCLI-Rails itself, if possible. The first idea that comes to mind is deleting old apps on boot, rather than deleting the current app on shutdown. What do you think? I'd be happy to put together a PR for this, if this strategy sounds acceptable. Footnotes: |
@botandrose thanks for putting in the (what sounds like immense) effort to track this down. I don't use Passenger, so I don't have much context on what a fix would take. It sounds like you've pair in blood sweat and tears to build up the necessary context, so please open your proposed PR. |
This works better with forking multi-process servers. Specifically, Phusion Passenger with its default configuration would delete the current compiled app prematurely, yielding 404s. Closes [thoughtbot#304]. [thoughtbot#304]: thoughtbot#304
Assets come through at first, but ~5 minutes later they return 404s. A rails server restart fixes this for another 5 minutes.
The text was updated successfully, but these errors were encountered: