Rename duplicate Railtie initializer to resolve TSort::Cyclic error - #187
Merged
Conversation
TSort::Cyclic: topological sort failed: [#<Rails::Initializable::Initializer:0x00007ff45d8c42f0 @group=:default, @name=:logstasher, @before=:load_config_initializers, @after=nil, @context=#<LogStasher::Railtie>, @block=#<Proc:0x00007ff4653371b8 /home/circleci/project/vendor/bundle/ruby/3.4.0/gems/logstasher-2.1.5/lib/logstasher/railtie.rb:43>>, #<Rails::Initializable::Initializer:0x00007ff45d8c4250 @group=:default, @name=:logstasher, @before=nil, @after=:logstasher, @context=#<LogStasher::Railtie>, @block=#<Proc:0x00007ff465b2cd50 /home/circleci/project/vendor/bundle/ruby/3.4.0/gems/logstasher-2.1.5/lib/logstasher/railtie.rb:56>>] (TSort::Cyclic)
Contributor
Author
|
@shadabahmed if you have time to look at it. 👍 |
Owner
Thanks for the fix. I'll merge and build a new release today or tomorrow |
Contributor
Author
|
Thanks |
Like\
```
1.1) Failure/Error: logger << "#{LogStasher.build_logstash_event(data, tags).to_json}\n"
LogStasher received :build_logstash_event with unexpected arguments
expected: (hash_including(:identifier=>"text template", :layout=>nil, :name=>"render_template.action_view", :request_id=>0, :ip=>"0.0.0.0", :route=>"#"), *(any args))
got: ({:action=>nil, :controller=>nil, :duration=>59.56, :error=>"AbstractController::DoubleRenderError\nRe...ormat=>:html, :ip=>"0.0.0.0", :method=>"GET", :path=>"/", :request_id=>0, :route=>"#", :status=>500}, ["request", "exception"])
Diff:
@@ -1,2 +1,13 @@
-["hash_including(:identifier=>\"text template\", :layout=>nil, :name=>\"render_template.action_view\", :request_id=>0, :ip=>\"0.0.0.0\", :route=>\"#\")",
- "*(any args)"]
+[{:action=>nil,
+ :controller=>nil,
+ :duration=>59.56,
+ :error=>
+ "AbstractController::DoubleRenderError\nRender and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like \"redirect_to(...); return\".\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/action_controller/metal/rendering.rb:166:in `render'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/action_controller/metal/instrumentation.rb:32:in `block (2 levels) in render'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/benchmark-0.5.0/lib/benchmark.rb:337:in `ms'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/action_controller/metal/instrumentation.rb:32:in `block in render'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/action_controller/metal/instrumentation.rb:101:in `cleanup_view_runtime'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/action_controller/metal/instrumentation.rb:31:in `render'\n/home/runner/work/logstasher/logstasher/spec/integration_spec.rb:74:in `index'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/action_controller/metal/basic_implicit_render.rb:8:in `send_action'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/abstract_controller/base.rb:215:in `process_action'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/action_controller/metal/rendering.rb:193:in `process_action'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/abstract_controller/callbacks.rb:261:in `block in process_action'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/activesupport-7.2.3/lib/active_support/callbacks.rb:101:in `run_callbacks'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/abstract_controller/callbacks.rb:260:in `process_action'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/action_controller/metal/rescue.rb:27:in `process_action'\n/home/runner/work/logstasher/logstasher/lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb:40:in `block in process_action'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/activesupport-7.2.3/lib/active_support/notifications.rb:210:in `block in instrument'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/activesupport-7.2.3/lib/active_support/notifications/instrumenter.rb:58:in `instrument'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/activesupport-7.2.3/lib/active_support/notifications.rb:210:in `instrument'\n/home/runner/work/logstasher/logstasher/lib/logstasher/rails_ext/action_controller/metal/instrumentation.rb:27:in `process_action'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/actionpack-7.2.3/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'\n/home/runner/work/logstasher/logstasher/lib/logstasher/rails_ext/action_controller/base.rb:11:in `process_action'\n/home/runner/work/logstasher/logstasher/spec/integration_spec.rb:46:in `block (4 levels) in <top (required)>'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example.rb:263:in `instance_exec'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example.rb:263:in `block in run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/hooks.rb:486:in `block in run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/hooks.rb:624:in `run_around_example_hooks_for'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/hooks.rb:486:in `run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example.rb:468:in `with_around_example_hooks'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example.rb:259:in `run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:653:in `block in run_examples'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:649:in `map'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:649:in `run_examples'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:614:in `run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:615:in `block in run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:615:in `map'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:615:in `run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:615:in `block in run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:615:in `map'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/example_group.rb:615:in `run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/runner.rb:121:in `map'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/configuration.rb:2097:in `with_suite_hooks'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/runner.rb:116:in `block in run_specs'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/reporter.rb:74:in `report'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/runner.rb:115:in `run_specs'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/runner.rb:89:in `run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/runner.rb:71:in `run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/lib/rspec/core/runner.rb:45:in `invoke'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/rspec-core-3.13.6/exe/rspec:4:in `<top (required)>'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/bin/rspec:25:in `load'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/bin/rspec:25:in `<top (required)>'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/cli.rb:492:in `exec'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/libexec/bundle:37:in `block in <top (required)>'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/libexec/bundle:29:in `<top (required)>'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/bin/bundle:25:in `load'\n/opt/hostedtoolcache/Ruby/3.2.9/x64/bin/bundle:25:in `<main>'",
```
|
@shadabahmed bump, would love this out too! |
Owner
|
@harrison-hd - thanks for the PR - can you check why some tests are failing ? Once fixed - I can quickly release new version |
Contributor
Author
|
I will done some real test tomorrow on one of our app. |
shadabahmed
added a commit
that referenced
this pull request
Nov 17, 2025
Owner
|
Thanks for this contribution - merged and release in logstasher 3.0.0 -> https://rubygems.org/gems/logstasher/versions/3.0.0 |
|
@benoittgt @shadabahmed thanks both! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With more recent Rails (8.1.1), it is not longer possible to start the app.
Because of duplicated initializer.
gem 'logstasher', github: 'benoittgt/logstasher', ref: 'ae26959d64aa49afa0a6929dfd4d83a8df4eed15'to test it on your projects.Fix: #186