I have been having lots of these problems on several Rails applications when running under Puma and doing load tests.
Other app servers work fine. I don't know if it's a problem with Puma or some thread-safety issue with the application themselves.
It happens in both Puma 2.11.0 and 2.10.2.
I have the same issue.
These are thread safety related issues with your app. Is this a rails app? What version?
It's rails 4.2. All the gems we're using declare they are thread-safe, but
someone is obv. lying :)
For the time being, being unable to troubleshoot the issue we had to turn
back to unicorn, but god I'd love to go with puma.
On Thu, Feb 5, 2015 at 10:16 PM, Evan Phoenix [email protected]
wrote:
These are thread safety related issues with your app. Is this a rails app?
What version?
Reply to this email directly or view it on GitHub
https://github.com/puma/puma/issues/647#issuecomment-73130460.
If you're able to provide some context (kind of request, backtrace, etc) I can look into the issue within rails as well.
I'll try to gather some info, thanks for the help.
I get this error only when I render routes from models (via Rails.application.routes.url_helpers helper). This request returns an ICS-formatted text file. I tried everything I could imagine, but could not reproduce this error manually. I keeps showing up in production. Here is my full backtrace:
NoMethodError: undefined method `url_options' for #<Module:0x007f8ec8817ed8>
1 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 271 in call
2 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 222 in call
3 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 334 in block (2 levels) in define_url_helper
4 File "/app/app/models/order.rb" line 428 in to_ics
5 File "/app/app/controllers/cleaners_controller.rb" line 158 in block (3 levels) in cal
... 2 non-project frames
6 File "/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/relation/delegation.rb" line 46 in each
7 File "/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/relation/delegation.rb" line 46 in each
8 File "/app/app/controllers/cleaners_controller.rb" line 158 in block (2 levels) in cal
... 2 non-project frames
9 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/mime_responds.rb" line 216 in call
10 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/mime_responds.rb" line 216 in respond_to
11 File "/app/app/controllers/cleaners_controller.rb" line 145 in cal
12 File "/app/app/controllers/cleaners_controller.rb" line 141 in ical
... 153 non-project frames
13 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/implicit_render.rb" line 4 in send_action
14 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/base.rb" line 198 in process_action
15 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/rendering.rb" line 10 in process_action
16 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/callbacks.rb" line 20 in block in process_action
17 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 117 in call
18 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 117 in call
19 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 151 in block in halting_and_conditional
20 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 151 in call
21 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 151 in block in halting_and_conditional
22 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 151 in call
23 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 151 in block in halting_and_conditional
24 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 151 in call
25 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 151 in block in halting_and_conditional
26 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 234 in call
27 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 234 in block in halting
28 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in call
29 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in block in halting
30 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in call
31 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in block in halting
32 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 151 in call
33 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 151 in block in halting_and_conditional
34 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in call
35 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in block in halting
36 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in call
37 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in block in halting
38 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 234 in call
39 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 234 in block in halting
40 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in call
41 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in block in halting
42 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in call
43 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in block in halting
44 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in call
45 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in block in halting
46 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in call
47 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 169 in block in halting
48 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 92 in call
49 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 92 in _run_callbacks
50 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 734 in _run_process_action_callbacks
51 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 81 in run_callbacks
52 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/callbacks.rb" line 19 in process_action
53 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/rescue.rb" line 29 in process_action
54 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/instrumentation.rb" line 31 in block in process_action
55 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb" line 164 in block in instrument
56 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb" line 20 in instrument
57 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb" line 164 in instrument
58 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/instrumentation.rb" line 30 in process_action
59 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/params_wrapper.rb" line 250 in process_action
60 File "/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/controller_runtime.rb" line 18 in process_action
61 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/abstract_controller/base.rb" line 137 in process
62 File "/app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/rendering.rb" line 30 in process
63 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal.rb" line 195 in dispatch
64 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal/rack_delegation.rb" line 13 in dispatch
65 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_controller/metal.rb" line 236 in block in action
66 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 73 in call
67 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 73 in dispatch
68 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 42 in serve
69 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/journey/router.rb" line 43 in block in serve
70 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/journey/router.rb" line 30 in each
71 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/journey/router.rb" line 30 in serve
72 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 802 in call
73 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
74 File "/app/vendor/bundle/ruby/2.2.0/gems/omniauth-1.2.2/lib/omniauth/strategy.rb" line 186 in call!
75 File "/app/vendor/bundle/ruby/2.2.0/gems/omniauth-1.2.2/lib/omniauth/strategy.rb" line 164 in call
76 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
77 File "/app/vendor/bundle/ruby/2.2.0/gems/omniauth-1.2.2/lib/omniauth/builder.rb" line 59 in call
78 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
79 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/rack/agent_hooks.rb" line 30 in traced_call
80 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 55 in call
81 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/rack/browser_monitoring.rb" line 23 in traced_call
82 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 55 in call
83 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/etag.rb" line 24 in call
84 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
85 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/conditionalget.rb" line 25 in call
86 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
87 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/head.rb" line 13 in call
88 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
89 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/params_parser.rb" line 27 in call
90 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
91 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/flash.rb" line 260 in call
92 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
93 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/session/abstract/id.rb" line 225 in context
94 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/session/abstract/id.rb" line 220 in call
95 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
96 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/cookies.rb" line 560 in call
97 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
98 File "/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/query_cache.rb" line 36 in call
99 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
100 File "/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 647 in call
101 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
102 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/callbacks.rb" line 29 in block in call
103 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 88 in call
104 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 88 in _run_callbacks
105 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 734 in _run_call_callbacks
106 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/callbacks.rb" line 81 in run_callbacks
107 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/callbacks.rb" line 27 in call
108 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
109 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/remote_ip.rb" line 78 in call
110 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
111 File "/app/vendor/bundle/ruby/2.2.0/gems/rollbar-1.3.1/lib/rollbar/middleware/rails/rollbar.rb" line 24 in block in call
112 File "/app/vendor/bundle/ruby/2.2.0/gems/rollbar-1.3.1/lib/rollbar.rb" line 747 in scoped
113 File "/app/vendor/bundle/ruby/2.2.0/gems/rollbar-1.3.1/lib/rollbar/middleware/rails/rollbar.rb" line 22 in call
114 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
115 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/debug_exceptions.rb" line 17 in call
116 File "/app/vendor/bundle/ruby/2.2.0/gems/rollbar-1.3.1/lib/rollbar/middleware/rails/show_exceptions.rb" line 22 in call_with_rollbar
117 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
118 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/show_exceptions.rb" line 30 in call
119 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
120 File "/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/rack/logger.rb" line 38 in call_app
121 File "/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/rack/logger.rb" line 20 in block in call
122 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb" line 68 in block in tagged
123 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb" line 26 in tagged
124 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb" line 68 in tagged
125 File "/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/rack/logger.rb" line 20 in call
126 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
127 File "/app/vendor/bundle/ruby/2.2.0/gems/request_store-1.1.0/lib/request_store/middleware.rb" line 8 in call
128 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
129 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/request_id.rb" line 21 in call
130 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
131 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/methodoverride.rb" line 22 in call
132 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
133 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/runtime.rb" line 18 in call
134 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
135 File "/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/cache/strategy/local_cache_middleware.rb" line 28 in call
136 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
137 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-rewrite-1.5.1/lib/rack/rewrite.rb" line 24 in call
138 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
139 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-cache-1.2/lib/rack/cache/context.rb" line 136 in forward
140 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-cache-1.2/lib/rack/cache/context.rb" line 245 in fetch
141 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-cache-1.2/lib/rack/cache/context.rb" line 185 in lookup
142 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-cache-1.2/lib/rack/cache/context.rb" line 66 in call!
143 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-cache-1.2/lib/rack/cache/context.rb" line 51 in call
144 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
145 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/static.rb" line 113 in call
146 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
147 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/sendfile.rb" line 113 in call
148 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
149 File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/ssl.rb" line 24 in call
150 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
151 File "/app/vendor/bundle/ruby/2.2.0/gems/utf8-cleaner-0.0.9/lib/utf8-cleaner/middleware.rb" line 18 in call
152 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
153 File "/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/engine.rb" line 518 in call
154 File "/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/application.rb" line 164 in call
155 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
156 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-reverse-proxy-0.4.4/lib/rack/reverse_proxy.rb" line 16 in call
157 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
158 File "/app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/deflater.rb" line 35 in call
159 File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
160 File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/configuration.rb" line 74 in call
161 File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/server.rb" line 492 in handle_request
162 File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/server.rb" line 363 in process_client
163 File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/server.rb" line 254 in block in run
164 File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/thread_pool.rb" line 101 in call
165 File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/thread_pool.rb" line 101 in block in spawn_thread
@dmkl Ok, I see what might be the problem in rails, but can you tell me what is on app/models/order.rb, line 428?
@evanphx it's Rails.application.routes.url_helpers.order_url(self), which returns a regular <server>/orders/:id url. My suspect was ActionPack 4.2, but other people reported that they could see this error with Puma only. I didn't try other servers. This error happens few times a day out of 1000+ same requests on my server. And doesn't happen with any controller- or view-originated calls to route helpers.
Ok, well, I'd recomend not calling url_helpers like that. It creates a new Module on every call it appears, which is super expensive, perf wise. I'll dig into it a little more, but seems like you should avoid the issue all together.
Yup, having same problems here.
In my case the error is raised by devise in one of its views when it calls one of its 'magic' paths (e.g. new_confirmation_path(resource_name)).
Backtrace:
ActionView::Template::Error: undefined method `url_options' for #<Module:0x007ffe03407410>
File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 271 in call
File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 222 in call
File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 334 in block (2 levels) in define_url_helper
File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/routes_proxy.rb" line 31 in new_user_confirmation_path
File "/app/vendor/bundle/ruby/2.2.0/gems/devise-3.4.1/lib/devise/controllers/url_helpers.rb" line 52 in new_confirmation_path
File "/app/app/views/devise/shared/_links.slim", line 11 in _app_views_devise_shared__links_slim__4228686031403603823_70364466969860
File "/app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/template.rb" line 145 in block in render
[...]
File "/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/application.rb" line 164 in call
File "/app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 57 in call
File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/configuration.rb" line 74 in call
File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/server.rb" line 492 in handle_request
File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/server.rb" line 363 in process_client
File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/server.rb" line 254 in block in run
File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/thread_pool.rb" line 101 in call
File "/app/vendor/bundle/ruby/2.2.0/gems/puma-2.10.2/lib/puma/thread_pool.rb" line 101 in block in spawn_thread
devise's url_helpers module: https://github.com/plataformatec/devise/blob/master/lib/devise/controllers/url_helpers.rb#L52
Do you think this is related to the Rails.application.routes.url_helpers issue you just explained ?
Thanks @evanphx, it's on my refactoring list, but calling Rails.application.routes.url_helpers shouldn't cause errors like this. Do you think it is related to Puma multithreading?
Same here, puma 2.11 and rails 4.2 and ruby 2.2.
Backtrace:
ActionView::Template::Error (undefined method `url_options' for #<Module:0x007fc23e2a8f20>):
1: <% provide(:title, "Login") %>
2: <%# should move such routes in application's application controller or even better the whole partial %>
3: <div class="options">
4: <%= link_to "Sign in", sign_in_link, class: "active" %>
5: <% if Casauth::Settings.new_account_text %>
6: <%= link_to(Casauth::Settings.new_account_text, account_creation_link, "data-no-turbolink" => true) %>
7: <% end %>
app/helpers/application_helper.rb:27:in `sign_in_link'
app/views/shared/_menu.html.erb:4:in `_app_views_shared__menu_html_erb___3576146891509294833_70236101630660'
Passing 'lock' command to redis as is; blind passthrough has been deprecated and will be removed in redis-namespace 2.0 (at /app/vendor/bundle/ruby/2.2.0/gems/pdxos-0.1.10/lib/pdxos/token.rb:17:in `block in generate')
ActionController::RoutingError (No route matches [HEAD] "/profile"):
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/rack/logger.rb:38:in `call_app'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/rack/logger.rb:20:in `block in call'
vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb:68:in `block in tagged'
vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb:26:in `tagged'
vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/tagged_logging.rb:68:in `tagged'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/rack/logger.rb:20:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/methodoverride.rb:22:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/runtime.rb:18:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/static.rb:113:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/rack-1.6.0/lib/rack/sendfile.rb:113:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/middleware/ssl.rb:24:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/honeybadger-2.0.2/lib/honeybadger/rack/error_notifier.rb:33:in `block in call'
vendor/bundle/ruby/2.2.0/gems/honeybadger-2.0.2/lib/honeybadger/config.rb:181:in `with_request'
vendor/bundle/ruby/2.2.0/gems/honeybadger-2.0.2/lib/honeybadger/rack/error_notifier.rb:30:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/honeybadger-2.0.2/lib/honeybadger/rack/user_feedback.rb:29:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/honeybadger-2.0.2/lib/honeybadger/rack/user_informer.rb:19:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/skylight-0.6.0/lib/skylight/middleware.rb:56:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/engine.rb:518:in `call'
vendor/bundle/ruby/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:164:in `call'
vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'
vendor/bundle/ruby/2.2.0/gems/puma-2.11.0/lib/puma/configuration.rb:82:in `call'
vendor/bundle/ruby/2.2.0/gems/puma-2.11.0/lib/puma/server.rb:507:in `handle_request'
vendor/bundle/ruby/2.2.0/gems/puma-2.11.0/lib/puma/server.rb:375:in `process_client'
vendor/bundle/ruby/2.2.0/gems/puma-2.11.0/lib/puma/server.rb:262:in `block in run'
vendor/bundle/ruby/2.2.0/gems/puma-2.11.0/lib/puma/thread_pool.rb:104:in `call'
vendor/bundle/ruby/2.2.0/gems/puma-2.11.0/lib/puma/thread_pool.rb:104:in `block in spawn_thread'
def account_creation_link
@create_account_path = "#{main_app.new_profile_path}#{build_service}"
end
Everyone having this issue is on MRI yes? Not JRuby on Rubinius?
@evanphx MRI
Also MRI here
On Feb 13, 2015 9:00 AM, "Dmitry Klimensky" [email protected]
wrote:
@evanphx https://github.com/evanphx MRI
—
Reply to this email directly or view it on GitHub
https://github.com/puma/puma/issues/647#issuecomment-74217777.
MRI here too
Il 13/feb/2015 09:30 "Filippos Vasilakis" [email protected] ha
scritto:
Also MRI here
On Feb 13, 2015 9:00 AM, "Dmitry Klimensky" [email protected]
wrote:@evanphx https://github.com/evanphx MRI
—
Reply to this email directly or view it on GitHub
https://github.com/puma/puma/issues/647#issuecomment-74217777.—
Reply to this email directly or view it on GitHub
https://github.com/puma/puma/issues/647#issuecomment-74220522.
Same thing here, ruby 2.0.0p576 (2014-09-19 revision 47628) [x86_64-darwin14.0.0]
@nicolaracco @PJK can you please gist backtraces?
To any future :+1:er, please provide a backtrace. I totally understand this is an issue but between myself and rails core we're not yet able to figure out what the problem is. We'll only be able to figure it out with more detailed info.
For what it's worth, I'm occasionally experiencing the same error since upgrading to ActionPack 4.2, but in a Sidekiq worker instead of Puma, so this might be a multithreading issue in ActionPack after all
Full backtrace: https://gist.github.com/nicolaracco/8d0e83f14663d29ab022
I'm experiencing this as well on Rails 4.2.0, Ruby 2.2.0 (MRI), Puma 2.11.0, Heroku cedar-14.
Here's a trace (from Sentry) on a fairly uninteresting view using a rails_admin route: https://gist.github.com/sbull/65c985c09e6c430af595
I've got other parts of my app in which this is happening that don't involve Puma at all, but happen during a long-lived "rails runner ..." process. It also uses threads to handle events: https://gist.github.com/sbull/654304a00dbb1aa7b02e
If I can help any more, let me know.
Here's a test script I'm using to demonstrate the problem. I get errors pretty reliably.
# via "rails runner"
num_threads = (ARGV[0] || 10).to_i
num_iterations = (ARGV[1] || num_threads).to_i
puts "Threads: #{num_threads}, Iterations per thread: #{num_iterations}"
threads = []
num_threads.times do |thread_num|
threads << Thread.new(thread_num) do |num|
Thread.current.thread_variable_set('num', num)
num_iterations.times do |i|
Thread.current.thread_variable_set('iter', i)
print num.to_s+Rails.application.routes.url_helpers.root_path
end
end
end
errors = []
threads.each do |thr|
begin
thr.join
print "\nFinished thread #{thr.thread_variable_get('num')}.\n"
rescue => e
errors << "\nException in thread #{thr.thread_variable_get('num')}, iteration #{thr.thread_variable_get('iter')}: #{e.message}\n"+e.backtrace.map{|bt| "\t#{bt}\n" }.join
end
end
puts "\n-------\nERRORS: #{errors.length}"
puts errors
OMG!! I can't wait to dig into this reproduction!!!! More details very soon!!
Sorry for the noise, my error actually originated from a Sidekiq worker:
https://gist.github.com/PJK/fc95af896faff98ee79c
Guessing from this, it's probably a Rails issue
Ok, update time.
This is a bug in MRI. I've opened a bug report with them: https://bugs.ruby-lang.org/issues/10871
You can see a quick way to reproduce the bug here: https://gist.github.com/evanphx/6eef92f2c40662a4171b
To work around this bug, you must never call Rails.application.routes.url_helpers in threaded code. You should call it in an initializer and then reuse the value in your code.
There is a usage of url_helpers in rails via RouteProxy that calls url_helpers on every method_missing. This must be a bug because that means that code is CRAZY slow, so I'm working with rails to get that fixed. /cc @tenderlove
Thank you for the full investigation on the error (on my part, but I bet I can safely say it's on behalf of everyone :)).
This isn't even Puma related!
My workaround, loaded in an initializer:
module Routes
module UrlHelpers
include Rails.application.routes.url_helpers
end
extend UrlHelpers
def self.default_url_options
ActionMailer::Base.default_url_options
end
end
Elsewhere, replace Rails.application.routes.url_helpers.<your_url_or_path>
with Routes.<your_url_or_path>.
How fix it?
@sbull thanks for your example. It reduced the number of occurrences almost to none for me, but the error still happens
As sad as this is, I'm going to go ahead and close this issue. It's a bug in MRI that we'll have to wait for a fix of.
The Bug: https://bugs.ruby-lang.org/issues/10871
The Fix: https://github.com/ruby/ruby/commit/d84f9b16946bca06ce0557ebe99152d7d445c9ec , it's going to be released in ruby 2.3, but (maybe) we are going to have it solved as a patch just for 2.1 and 2.2. I'm waiting for it.
@sbull thanks a ton for posting your fix!
FYI for anyone watching this thread: this is apparently mitigated in MRI 2.2.4 but not fixed completely until 2.3.
I had similar issue which I could only reproduce at load test:
NoMethodError: undefined method `_save_callbacks' for #Class:0x007fdf99ebca00>
Seems that ruby-2.3.0 fixed it :)
Most helpful comment
Ok, update time.
This is a bug in MRI. I've opened a bug report with them: https://bugs.ruby-lang.org/issues/10871
You can see a quick way to reproduce the bug here: https://gist.github.com/evanphx/6eef92f2c40662a4171b
To work around this bug, you must never call
Rails.application.routes.url_helpersin threaded code. You should call it in an initializer and then reuse the value in your code.There is a usage of
url_helpersin rails via RouteProxy that callsurl_helperson every method_missing. This must be a bug because that means that code is CRAZY slow, so I'm working with rails to get that fixed. /cc @tenderlove