Closed nicolas-brousse closed 5 years ago
Thanks @nicolas-brousse for the report!
We need to investigate this. Please let us know if you have more information.
@sigmike @florentferry any idea about what could be the cause of this?
@Spone I have the same issue. I cannot reproduce it, but it happens in production sporadically few times a day. Please help!
Hi @dmkl.
I have some questions that may help us to know where to search.
In our project we still have the issue, but the Component is not always the same. I don't know if it's related when the application is started and for the first request, but it may be the case.
For our project we use the following:
@nicolas-brousse sure:
I cannot find any correlation between occurrences. It doesn't seem to be related to server restarts.
…esupport-5.2.0/lib/active_support/inflector/methods.rb: 283:in `const_get'
…esupport-5.2.0/lib/active_support/inflector/methods.rb: 283:in `block in constantize'
…esupport-5.2.0/lib/active_support/inflector/methods.rb: 281:in `each'
…esupport-5.2.0/lib/active_support/inflector/methods.rb: 281:in `inject'
…esupport-5.2.0/lib/active_support/inflector/methods.rb: 281:in `constantize'
….2.0/lib/active_support/core_ext/string/inflections.rb: 68:in `constantize'
…ms/komponent-2.2.0/lib/komponent/component_renderer.rb: 41:in `_render'
…ms/komponent-2.2.0/lib/komponent/component_renderer.rb: 28:in `render'
…gems/komponent-2.2.0/lib/komponent/komponent_helper.rb: 8:in `component'
/app/frontend/components/root_page/_root_page.html.slim:9
...
@dmk thanks for this info. It give us more visibility, but it still a weird issue. I'll try to take some time to try to understand what happen.
I have to take a bit of time in our sentry to check if the error appear less often since we moved from 2.5.3 to 2.6.1.
Hi @dmkl,
we're wondering if we shouldn't eager load the component modules.
That's how draper
does it for instance: https://github.com/drapergem/draper/blob/master/lib/draper/railtie.rb#L15
See these links on the topic:
Could you try replacing:
config.autoload_paths << config.root.join("app/frontend/components")
with
config.paths.add "frontend/components", eager_load: true
in your app, and let us know if you still experience the error?
I'll also do the update to check.
@Spone, @nicolas-brousse thank you! I'll update to eager loading and let you know in a while if it helps.
@Spone, @nicolas-brousse eager loading seems to resolve the issue. Since updating config settings to eager_load: true
I didn't see this error for 3 weeks (ruby 2.5.3, Rails 5.2.0). Thank you!
Yay! Sounds like a great news!
Thank you too for testing and let us know 🙂
Great, we'll add this in a future release! Thanks @dmkl
Sometimes I got this kind of exception on production projects.
But I've no idea of what is causes this. I didn't have similar exception on other classes than
Component
classes.Does it something you already noticed?