Add monkey patch to unicorn to fix eof? problem
Rack with Unicorn is unable to handle chunked requests due to private `eof?` method. This exposes `eof?` not changing `rack` behavior. Issue: https://gitlab.com/gitlab-org/gitlab-ee/issues/8539
This commit is contained in:
		
							parent
							
								
									56da230826
								
							
						
					
					
						commit
						dc962788fa
					
				
							
								
								
									
										7
									
								
								Gemfile
								
								
								
								
							
							
						
						
									
										7
									
								
								Gemfile
								
								
								
								
							| 
						 | 
					@ -7,6 +7,11 @@ gem_versions = {}
 | 
				
			||||||
gem_versions['activerecord_sane_schema_dumper'] = rails5? ? '1.0'    : '0.2'
 | 
					gem_versions['activerecord_sane_schema_dumper'] = rails5? ? '1.0'    : '0.2'
 | 
				
			||||||
gem_versions['rails']                           = rails5? ? '5.0.7'  : '4.2.10'
 | 
					gem_versions['rails']                           = rails5? ? '5.0.7'  : '4.2.10'
 | 
				
			||||||
gem_versions['rails-i18n']                      = rails5? ? '~> 5.1' : '~> 4.0.9'
 | 
					gem_versions['rails-i18n']                      = rails5? ? '~> 5.1' : '~> 4.0.9'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# The 2.0.6 version of rack requires monkeypatch to be present in
 | 
				
			||||||
 | 
					# `config.ru`. This can be removed once a new update for Rack
 | 
				
			||||||
 | 
					# is available that contains https://github.com/rack/rack/pull/1201.
 | 
				
			||||||
 | 
					gem_versions['rack']                            = rails5? ? '2.0.6' : '1.6.11'
 | 
				
			||||||
# --- The end of special code for migrating to Rails 5.0 ---
 | 
					# --- The end of special code for migrating to Rails 5.0 ---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
source 'https://rubygems.org'
 | 
					source 'https://rubygems.org'
 | 
				
			||||||
| 
						 | 
					@ -154,6 +159,8 @@ gem 'icalendar'
 | 
				
			||||||
gem 'diffy', '~> 3.1.0'
 | 
					gem 'diffy', '~> 3.1.0'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Application server
 | 
					# Application server
 | 
				
			||||||
 | 
					gem 'rack', gem_versions['rack']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
group :unicorn do
 | 
					group :unicorn do
 | 
				
			||||||
  gem 'unicorn', '~> 5.1.0'
 | 
					  gem 'unicorn', '~> 5.1.0'
 | 
				
			||||||
  gem 'unicorn-worker-killer', '~> 0.4.4'
 | 
					  gem 'unicorn-worker-killer', '~> 0.4.4'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1088,6 +1088,7 @@ DEPENDENCIES
 | 
				
			||||||
  pry-rails (~> 0.3.4)
 | 
					  pry-rails (~> 0.3.4)
 | 
				
			||||||
  puma (~> 3.12)
 | 
					  puma (~> 3.12)
 | 
				
			||||||
  puma_worker_killer
 | 
					  puma_worker_killer
 | 
				
			||||||
 | 
					  rack (= 2.0.6)
 | 
				
			||||||
  rack-attack (~> 4.4.1)
 | 
					  rack-attack (~> 4.4.1)
 | 
				
			||||||
  rack-cors (~> 1.0.0)
 | 
					  rack-cors (~> 1.0.0)
 | 
				
			||||||
  rack-oauth2 (~> 1.2.1)
 | 
					  rack-oauth2 (~> 1.2.1)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1079,6 +1079,7 @@ DEPENDENCIES
 | 
				
			||||||
  pry-rails (~> 0.3.4)
 | 
					  pry-rails (~> 0.3.4)
 | 
				
			||||||
  puma (~> 3.12)
 | 
					  puma (~> 3.12)
 | 
				
			||||||
  puma_worker_killer
 | 
					  puma_worker_killer
 | 
				
			||||||
 | 
					  rack (= 1.6.11)
 | 
				
			||||||
  rack-attack (~> 4.4.1)
 | 
					  rack-attack (~> 4.4.1)
 | 
				
			||||||
  rack-cors (~> 1.0.0)
 | 
					  rack-cors (~> 1.0.0)
 | 
				
			||||||
  rack-oauth2 (~> 1.2.1)
 | 
					  rack-oauth2 (~> 1.2.1)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					title: Add monkey patch to unicorn to fix eof? problem
 | 
				
			||||||
 | 
					merge_request: 23385
 | 
				
			||||||
 | 
					author:
 | 
				
			||||||
 | 
					type: fixed
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,10 @@ if defined?(Unicorn)
 | 
				
			||||||
    # Max memory size (RSS) per worker
 | 
					    # Max memory size (RSS) per worker
 | 
				
			||||||
    use Unicorn::WorkerKiller::Oom, min, max
 | 
					    use Unicorn::WorkerKiller::Oom, min, max
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Monkey patch for fixing Rack 2.0.6 bug:
 | 
				
			||||||
 | 
					  # https://gitlab.com/gitlab-org/gitlab-ee/issues/8539
 | 
				
			||||||
 | 
					  Unicorn::StreamInput.send(:public, :eof?) # rubocop:disable GitlabSecurity/PublicSend
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require ::File.expand_path('../config/environment',  __FILE__)
 | 
					require ::File.expand_path('../config/environment',  __FILE__)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue