Skip to content
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

fix: Define 'sync' method on logger for compatibility with Puma > 5 #355

Merged
merged 1 commit into from
Sep 4, 2023
Merged

fix: Define 'sync' method on logger for compatibility with Puma > 5 #355

merged 1 commit into from
Sep 4, 2023

Conversation

ball-hayden
Copy link
Contributor

Description:

Since at least puma/puma@a284179, puma has required that the logger respond to a sync method.

This implements the above method. With this change, Gemstash will start with Puma 6.3.1 when the --no-daemonize flag is passed.

It might also be worth changing the daemonize default to false - Puma versions greater than ~5.0 do not support demonizing (without https://github.com/kigster/puma-daemon or alternative)?


Tasks:

  • Describe the problem / feature
  • Write tests

I will abide by the code of conduct.

@n-rodriguez
Copy link

👍

The error :

nonroot@b098cdf13b8a:/app$ bin/gemstash start --no-daemonize --config-file /app/config.yml.erb
Starting gemstash!
[2023-09-03 19:47:54 +0000] - INFO - [118] Puma starting in cluster mode...
/app/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/log_writer.rb:80:in `internal_write': undefined method `sync' for #<Gemstash::Logging::StreamLogger:0x00007f1943db9e90 @level=1> (NoMethodError)

          @stdout.flush unless @stdout.sync
                                      ^^^^^
	from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/log_writer.rb:66:in `log'
	from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/runner.rb:45:in `log'
	from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/runner.rb:107:in `output_header'
	from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/cluster.rb:341:in `run'
	from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/launcher.rb:194:in `run'
	from /app/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/cli.rb:75:in `run'
	from /app/vendor/bundle/ruby/3.2.0/gems/gemstash-2.3.0/lib/gemstash/cli/start.rb:16:in `run'
	from /app/vendor/bundle/ruby/3.2.0/gems/gemstash-2.3.0/lib/gemstash/cli.rb:79:in `start'
	from /app/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
	from /app/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /app/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
	from /app/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
	from /app/vendor/bundle/ruby/3.2.0/gems/gemstash-2.3.0/lib/gemstash/cli.rb:34:in `start'
	from /app/vendor/bundle/ruby/3.2.0/gems/gemstash-2.3.0/exe/gemstash:6:in `<top (required)>'
	from bin/gemstash:27:in `load'
	from bin/gemstash:27:in `<main>'

@olleolleolle
Copy link
Member

OK, so the CI failure is a little tricky, but has nothing to do with this change.

With JRuby 9.4, we got:

In Gemfile:
  gemstash was resolved to 2.3.0, which depends on
    sequel was resolved to 5.72.0, which depends on
      bigdecimal

@olleolleolle olleolleolle merged commit 3522f88 into rubygems:main Sep 4, 2023
@olleolleolle
Copy link
Member

Merging this compatibility-with-the-webserver-we-use change, and logging an Issue about the JRuby 9.4 not building correctly. It did build correctly just the other day.

olleolleolle added a commit that referenced this pull request Sep 4, 2023
@ball-hayden ball-hayden deleted the puma-6 branch September 4, 2023 07:48
@ball-hayden
Copy link
Contributor Author

Thanks @olleolleolle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants