-
Notifications
You must be signed in to change notification settings - Fork 435
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
Better errors page significantly slower with Puma 3.x #341
Comments
Definitely significant change in load time for the right panel from Puma 2.16 to Puma 3.1. |
Same issue here when using |
Also as another note this appears to be related to the |
@mikereinmiller - good observation. maybe one of us should open a ticket at |
@DannyBen Probably a good idea, I'll let you get it started since you started this thread as well. I suppose this issue on better_errors could be closed as well. |
I would keep this ticket open for now, even if just for the benefit of users observing the issue and coming to report. EDIT: Also, I am also a little concerned. Seems like |
When running |
@umhan35 is right, when running the app with Here's the output of both (I replaced \n with actual line breaks to make it slightly more readable): https://gist.github.com/cannikin/1e62e4a9b4f6f691de358bf84232c4da (You'll have to click RAW to see the full Rails one: it's just too big.) It appears the |
I've got a hack if you want to keep using
In the long run I don't think this is actually a problem with binding_of_caller or better_errors. I think something about Rails object structure changed between 4.2 and 5.0 which just causes MUCH more data to be dumped when inspecting those variable groups. |
Worth mentioning that the chrome thread was using 50% CPU for my machine with the better_errors page open in the background (!!!) Would really love to see @cannikin's solution applied as a configuration option to disable these features since this also prevents large ActiveRecord queries from being performed (since |
Just want to point out that the fork of @cannikin seems to break REPL for me (which is the only reason I have binding_of_caller in my Gemfile anyways). So it seems worthless to me. By the way: the web-console gem (which is included in Rails 5 by default) offers a very fast REPL from within standard error pages (or by placing a |
as a temp solution to reduce response size from __better_errors/xxxxx/variables you can add next code to application_controller.rb: before_action :better_errors_hack, if: -> { Rails.env.development? }
def better_errors_hack
env['puma.config'].options.user_options.delete :app
end in this case response size using |
@vavgustov that wasn't working for me, this does: before_action :better_errors_hack, if: -> { Rails.env.development? }
def better_errors_hack
request.env['puma.config'].options.user_options.delete :app
end |
@inopinatus you probably use rails 5.1.
So yes better to use |
confirmed, this came up during 5.1rc1 upgrade preparation. |
Hmm, I'm on 5.0.2 and @vavgustov / @inopinatus hack doesn't seem to have any effect for me. better_errors takes forever to render again and the Rack session output is MASSIVE. Full dump here: https://gist.github.com/cannikin/d71e442b6ca46fba130448207ce8f2c9 |
I was making a PR that might fix this issue in #360, can anyone confirm? The root cause of the problem is just because puma has a "big variable" and better_errors tries to serialize everything. The PR allows users to configure a maximum size, above which they do not attempt to serve the heftier payloads to the browser. I haven't tested this on 5.x yet at all, but progress on getting the PR reviewed/merged seems to have stalled a little (no hate, we're all busy people 😎 ) Busy this weekend but I can take a look on Monday if there is any feedback on the PR, keen to help get this in people's hands as it's such a relatively small fix for huge Quality of Life gains! |
Any progress on this ? It feels kind of silly that Is there anything we can help with in order to speed up the process ? |
This is NOT better_errors' fault! That being said, here's what I'm doing to help this: before_action :better_errors_hack, if: -> { Rails.env.development? }
def better_errors_hack
request.env['puma.config'].options.user_options.delete :app
end |
Although this may not be a better_errors fault, it is observed only when using better_errors, and renders the better_errors gem a little less useful (or at least less... better...). Why not enable this hack (or similar) by default in the better_errors gem, so that all its users can return to using it happily, and being eternally grateful? Judging by the length of this thread, it is obvious that it bothers a few people, and many think (correctly or not) that it is a better_errors problem. |
@pachonk I would certainly class it as a behaviour that If anyone can find problems with the PR (#360) I will happily make the changes, but I've used it in development for months (from my fork) without problem. As far as I am aware the PR is classed as "failing" due to a problem with the Continuous Integration for the project rather than any failing/missing tests, but I'm happy to be corrected and put the work in if we can get this merged and released :) |
My slightly naive workaround broke things like class ApplicationController < ActionController::Base
before_action :better_errors_hack, if: -> { Rails.env.development? }
#...
private
def better_errors_hack
request.env['puma.config'].options.user_options.delete(:app) if request.env.has_key?('puma.config')
end
end |
Seems this issue will be fixed in version 2.5. Meanwhile I added fix from above comments |
@RobinDaugherty thanks, it seems fixed to me! |
Can confirm! I updated better_errors from 2.1.1 to 2.4 and the console loads way faster now (2.1.1: 30-60 seconds / 2.4: 1 second). This is life changing! Thank you sooo much! |
Hi,
I noticed the better_errors page became very slow to show the right panel. The page loads quickly, but the right panel takes several seconds to load.
I believe I have traced the problem to Puma 3.x.
Puma 2.16.0 works fast
Puma 3.0.0 and the latest 3.1.1 load the right pane slowly.
The text was updated successfully, but these errors were encountered: