Slow assets ruby 1.9.3, macos, rails 3.2 - ruby-on-rails

Im have a really weird issue, my assets served really slow in development(10 sec per file), thia happens only in Chrome(17.0.963.79). In Firefox all works just fine.
My setup:
RVM
Ruby-1.9.3#p125
Rails 3.2.0
Mac OS 10.7.3
I have tried switch from webrick to mongrel and thin, using rails-dev-tweaks gem, set cache classes to true and false. All this didnt help, im stuck why it's work slow only in chrome and not in firefox? Also this is fresh setup of OS, maybe im missing something, thanks!
UPD. If this initial request(e.g. from new tab) all goes smooth. Request take near 2 minute only if im refreshing page. I just can't wrap my head around this issue :(

This seems to have something to do with name resolution.
Using (chrome) and
localhost:3000/ -- great performance
127.0.0.1:3000/ -- great performance
hostname.local:3000/ - Terrible performance as you describe
This is unfortunate for me, as I have an alias set up in /etc/hosts to point to 127.0.0.1 that affects how the page gets displayed. So no testing of that in chrome.

I had the same problem.
Try setting config.assets.debug = false in development.rb. It helped in my case.

We ran into this issue and solved it through using a pow server since it resolves to port 80.
To install pow
curl get.pow.cx | sh
Here is a link to the source for the paranoid.
Hope that helps.

Related

Rails server hanging even with even freshly created app

My rails server started hanging today, so I tried running different apps to see if the issue was caused by my app, even created an empty app and with that even the default page doesn't come up.
I've been using it as just an http server, testing front-end with adding files into the public folder, so, I don't even compile any actual ruby code, just plain HTML, CSS and JS.
When I try to browse localhost:3000, the page is unresponsive, I can't even view source and I'd like to add that this happens with Chrome, Safari, IE and Edge, so I don't think it's a caching issue on the browser front.
I tried running the server on a specific ip and port, also tried the 0.0.0.0 trick mentioned on some other questions, doesn't help me so far.
I'm using ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15] and Rails 4.2.5.
Any ideas?
Well, I ended up resolving the issue by uninstalling and reinstalling the whole stack. Couldn't find the reason behind the issue but if you get stuck with the same problem, apparently a complete reinstall fixes it...

Webrick dies with illegal instruction 4

Ever since switching to Mac based RoR development, I occasionally see that Webrick dies after simply printing 'Illegal Instruction 4'.
OSX 10.7.2, 10.7.3 and now 10.7.4
ruby 1.9.2p290
rails 3.2.2, and various other version starting with 3.1
So far, it's been rather innocuous, I just hit the up arrow key, hit enter, and restart the server, and everything is fine.
I've noticed that immediately after adding a new file to the development environment will almost always cause this condition. But it has happened when I haven't recently added a new file. But it almost always happens immediately after some file change. Put another way, I don't think it's ever happened when I'm just testing stuff, it seems that some kind of filesystem change is required to trigger this.
Just now, it happened, but this time it seems to of wedged up Webrick in some way, and after restarting Webrick, it wouldn't respond, I had to reboot to clear the condition. So this is starting to look less innocuous, and more like a looming development productivity problem.
Any other Mac developers seeing this?
I encountered this problem after implementing a scope on one of my models
scope :list_only, lambda { show_on_list }
(where show_on_list is an instance method). After rewriting the method to
scope :list_only, where("SomeSQLHere")
(where I used SQL in SomeSQLHere) it worked fine. I realize this doesn't address what "Illegal Instruction 4" means, but maybe the problem stems from some bad scope?
Do you have similar problems using non-webrick app servers? I encourage developing with the same app server you deploy with, which in this case looks to be Passenger.

rails 3.2.1 very slow in development mode

Since i upgrade my app on my development server, the request are terribly slow. Event if the log seems to render quite quickly, it take 10-15 second for the loading to be complete (event if the page is already fully loaded)
My configuration :
Rails 3.2.1
Ruby 1.9.3-p125 (rvm)
Standalone Passenger (3.0.11)
I do not have this kind of issue on my development machine, so i guess the problem is not coming from my application
I had a very similar problem. Found this question ( Slow assets ruby 1.9.3, macos, rails 3.2 ) which helped me discover it was chrome where the problem was occurring. Still don't know why, or how to fix it.
In my case it was Rails Panel extension that was slowing Chrome. I just disabled it and it the app became 3 times faster.

Newbie help with Rails/Ruby. Totally lost! (Mongrel related, I think) 503 Errors

I am on the verge of actually hiring someone to fix this
for me, but I hope it doesn't come to that.
I have no experience with Rails/Ruby, but I do know my way around
computers in general.
I have two domains on one server (Hostingrails, I am beginning to hate
them more and more these days).
My secondary domain works 100% fine.
But for the past few days, my primary domain has not been working, it
has been giving me 503 Errors. I've opened a ticket regarding this, and
they told me to SSH into my server and reset "Mongrel". I've done this
using the code they gave me; "mongrel_rails start -d -e production
-p13930"
It seemed to have worked, but the problem was still there. The log says
the error is something about:
"require': no such file to load -- dispatcher (LoadError)"
I've re-opened a ticket concerning this, and Hostingrails basically told
me that it is not their problem anymore and that it's solely up to me to
fix it. Brilliant.
So I spent a good part of the day looking and changing things around
through SSH (probably wasn't the greatest idea) but I still keep getting
503'd on my website.
However, I recently found out that my index file HAS to be index.html,
or it will not render the page. index.htm or index.php will result in a
503. If I set the index page to index.html, it worked. Which is strange,
my htaccess file allowed for all.
Another problem, I think I have inadvertently changed something in my
settings while I was SSH'd in. When I do "bundle install" it installs
the gems into my own private webspace, for example /home/mywebsite. But
I believe on my shared plan, all the rails/ruby/gems etc are all under
/usr/local/rvm/gems/ruby-1.9.2-p0/ which I don't think I have access to.
How do I change the directory to the default one? For example, before
the error log said:
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require': no such file to load -- dispatcher (LoadError)
Now it says:
/home/mysite/.gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require': no such file to load -- dispatcher (LoadError)
I think that's everything for now. Here are the rails installed on my
server by the host:
Installed at (3.0.0): /usr/local/rvm/gems/ruby-1.9.2-p0
(2.3.8): /usr/local/rvm/gems/ruby-1.9.2-p0
(again, I think my mongrel is looking in the wrong place, as my gems are
now being installed into /home/mywebsite/ instead of
/usr/local/rvm/gems/) Is it possible to someone reset the settings I've
changed back into my host's default one?
Would anyone be willing to take the time and try and fix this with me? I
am pretty annoyed at Hostingrails, since I didn't do anything to create
this problem, and they are outright refusing to help me. Why is my
primary domain getting 503 errors when my secondary domain works fine?
Mongrel is not compatible to ruby 1.9.2. You need use a fork of mongrel to use it https://github.com/kyusik/mongrel_cluster
I advice you to user thin/passenger or unicorn instead of mongrel.
I found a little blog post about problem with Mongrel and ruby 1.9.2 http://xaop.com/blog/2010/08/04/deploying-rails-3-on-ruby-1-9-2/
Maybe you could try using Ruby 1.8.7 - it causes less trouble in general at this time.
Not an answer to your question in particular, but if you're new to Ruby and Rails, then hosting your own stuff can be a daunting task.
Instead, try Heroku - simply push your Rails app to Heroku with git and you're good to go. They support custom domainnames for free.

Rails 5.1.7 Server Hangs On First Request

We are trying to update a Rails Server to release 5.1.
Server starts fine; but on the first request, goes completely dead; and has to be killed with signal 9.
Doesn't matter if its Puma or Webrick.
Doesn't matter if its 5.1.0 or 5.1.7
Doesn't matter if its development or production mode.
Eventually I saw the process size was 90GB and growing!
I've tried rbtrace, but struggled to get anything meaningful out of it.
I'm on osx, so strace isn't available, and I've struggled to get dtrace or dtruss to work, or produce anything meaningful.
So looking for a way to get this rails server to tell me what it's problem is....
Let me know what additional information is salient.
After quite a long process, I found a solution that didn't so much find the source of the issue, but provided a process to work around it.
First off, I used
rails app:update
And accepted all of the overwrites. Then using git, I walked through all of the removed code from my config file and returned just the required sections [like config/routes.rb, and ActionMailer config, for example].
Application then started right up, no issue.
This also led me to
http://railsdiff.org/5.0.7.2/5.1.0
Which is pretty critical for Rails upgrading. This is well worth consuming:
https://github.com/rails/rails/issues/31377#issuecomment-350422347

Resources