[BUG?] Should error pages be rendered if requesting an image?

19 views
Skip to first unread message

Ariel Juodziukynas

unread,
Sep 9, 2016, 11:52:40 AM9/9/16
to Ruby on Rails: Core
I came across a problem when updating from rails3 to rails5, every time I request an image and the file is missing, the requests takes almost 2 seconds to finish because of the routes table taking too long to render (I have a project with +2600 routes).

If 5 or more images are missing, it takes so long that even some of them render this error:

Internal Server Error

could not obtain a connection from the pool within 5.000 seconds (waited 5.208 seconds); all pooled connections were in use
WEBrick/1.3.1 (Ruby/2.2.2/2015-04-13) at localhost:3002

I know that adding the missing images fixes the routing error and all that, but it's a local dev environment of a site with a lot of not crucial images and I really don't need them taking up my disk free space to develop.

So, my question is, should rails render an error page when the requests is an image request? the request header has 'Accept: image/webp,image/*,*/*;q=0.8' so rails could be able to detect that it's an image request and not render the whole Routing Error page.

I made another issue proposing an option to disable the routes table on the Routing Error page, but that would be workaround and a solution to another problem.
Reply all
Reply to author
Forward
0 new messages