einhorn 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf1c281da283b0ee43ed8cbaeddb906c1804a28a4cbbbb48fd6d7ec9840491a6
4
- data.tar.gz: 18642e07afb648a5d00e0b9006f9331496353ca719928a50a2c1cf340372c6cd
3
+ metadata.gz: c27575ecf4150906398eb1b48506bc91a1891ea6bc861ec3b26a3bd7338a1c9d
4
+ data.tar.gz: 31729bfe873c278e617e0e06ba4c7eb0bc48610a462e2d1e735cb3633b3b714f
5
5
  SHA512:
6
- metadata.gz: 7660f7388e99b82efb48444ffeebfc776b3a3df2f51a4f87e56b85381cbe1993958601dd2c24a88438755074952c6b326ce1ba895d1c769924e028ca98b90bff
7
- data.tar.gz: 876641c4e3e32668aca676c0636786c2dfd2ed1d4d0cc5b9fc33bf01c9d1c6c60d128719deb7a98f20432fbd7982069bdc8cb52bff59b7a73a6dbf7379f09973
6
+ metadata.gz: c1e19de40ef6ba91c7ca05fdfd48224f841885ef1b93180ce48fdb47ba217f72573548d8de37b30e63dc9edfeacaf82d72201cbdbd43366cdef7c4c4bb639ffd
7
+ data.tar.gz: db21b2aa478724ffa0cc6ff690c5dd4d51592bfe1a8432f01f89b6b63640aeaf24257e90a929efe96efa6b178877d9f957505732a83a489676490f99dd3f57d6
data/Changes.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 1.1.1
2
+
3
+ - Fix a few Ruby deprecations
4
+ - Use `Process.warmup` with `--gc-before-fork`
5
+
6
+ # 1.1.0
7
+
8
+ - Add `logger` and `readline` gem dependencies for Ruby 4.0
9
+ - Make the `fiddle` gem dependency optional.
10
+ This gem is only necessary if you use the `-k` flag and since
11
+ it is native, requires libffi and a compiler to be installed.
12
+ Add `gem "fiddle"` to your Gemfile to use the `-k` flag.
13
+
1
14
  # 1.0.1
2
15
 
3
16
  - Add `fiddle` to gemspec dependencies [#111]
data/README.md CHANGED
@@ -200,7 +200,7 @@ Then you could set `--reexec-as=` to the name of your bash script and it will ru
200
200
  -f, --lockfile LOCKFILE Where to store the Einhorn lockfile
201
201
  -g, --command-socket-as-fd Leave the command socket open as a file descriptor, passed in the EINHORN_SOCK_FD environment variable. This allows your worker processes to ACK without needing to know where on the filesystem the command socket lives.
202
202
  -h, --help Display this message
203
- -k, --kill-children-on-exit If Einhorn exits unexpectedly, gracefully kill all its children
203
+ -k, --kill-children-on-exit If Einhorn exits unexpectedly, gracefully kill all its children (linux only, requires the fiddle gem)
204
204
  -l, --backlog N Connection backlog (assuming this is a server)
205
205
  -m, --ack-mode MODE What kinds of ACK to expect from workers. Choices: FLOAT (number of seconds until assumed alive), manual (process will speak to command socket when ready). Default is MODE=1.
206
206
  -n, --number N Number of copies to spin up
data/bin/einhorn CHANGED
@@ -227,6 +227,14 @@ if true # $0 == __FILE__
227
227
  end
228
228
 
229
229
  opts.on('-k', '--kill-children-on-exit', 'If Einhorn exits unexpectedly, gracefully kill all its children') do
230
+ # Fiddle is only necessary for this feature flag.
231
+ # Since fiddle is our only native dependency and we don't want to force
232
+ # a compiler on everyone, we make it optional.
233
+ begin
234
+ require "fiddle"
235
+ rescue LoadError
236
+ warn "Please add `gem 'fiddle'` to your Gemfile to use einhorn's -k flag"
237
+ end
230
238
  Einhorn::State.kill_children_on_exit = true
231
239
  end
232
240
 
data/einhorn.gemspec CHANGED
@@ -25,5 +25,8 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency "minitest", "~> 5"
26
26
  gem.add_development_dependency "mocha", "~> 2"
27
27
  gem.add_development_dependency "subprocess", "~> 1"
28
- gem.add_dependency "fiddle", "~> 1.1"
28
+ # Fiddle is native and only needed for `-k` on Linux so we make it optional
29
+ # gem.add_dependency "fiddle", "~> 1.1"
30
+ gem.add_dependency "logger"
31
+ gem.add_dependency "readline"
29
32
  end
@@ -297,7 +297,7 @@ module Einhorn::Command
297
297
  # Used by einhornsh
298
298
  command "ehlo" do |conn, request|
299
299
  <<~EOF
300
- Welcome, #{request["user"]}! You are speaking to Einhorn Master Process #{$$}#{Einhorn::State.cmd_name ? " (#{Einhorn::State.cmd_name})" : ""}.
300
+ Welcome, #{request["user"]}! You are speaking to Einhorn Master Process #{$$}#{" (#{Einhorn::State.cmd_name})" if Einhorn::State.cmd_name}.
301
301
  This is Einhorn #{Einhorn::VERSION}.
302
302
  EOF
303
303
  end
@@ -15,7 +15,7 @@ module Einhorn::Event
15
15
  @socket = sock
16
16
  @client_id = "#{@@instance_counter}:#{sock.fileno}"
17
17
 
18
- @read_buffer = ""
18
+ @read_buffer = +""
19
19
  @write_buffer = +""
20
20
 
21
21
  @closed = false
@@ -113,7 +113,7 @@ module Einhorn::Event
113
113
 
114
114
  # Override in subclass. This lets you do streaming reads.
115
115
  def parse_record
116
- [@read_buffer, ""]
116
+ [@read_buffer, +""]
117
117
  end
118
118
 
119
119
  def consume_record(record)
@@ -4,6 +4,7 @@ require "fiddle/import"
4
4
  module Einhorn
5
5
  module PrctlRaw
6
6
  extend Fiddle::Importer
7
+
7
8
  dlload Fiddle.dlopen(nil) # libc
8
9
  extern "int prctl(int, unsigned long, unsigned long, unsigned long, unsigned long)"
9
10
 
@@ -1,3 +1,3 @@
1
1
  module Einhorn
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.1"
3
3
  end
data/lib/einhorn.rb CHANGED
@@ -94,6 +94,7 @@ module Einhorn
94
94
 
95
95
  module TransientState
96
96
  extend AbstractState
97
+
97
98
  def self.default_state
98
99
  {
99
100
  whatami: :master,
@@ -255,7 +256,13 @@ module Einhorn
255
256
  log_info("Requiring #{path} (if this hangs, make sure your code can be properly loaded as a library)", :upgrade)
256
257
  require path
257
258
 
258
- force_move_to_oldgen if Einhorn::State.config[:gc_before_fork]
259
+ if Einhorn::State.config[:gc_before_fork]
260
+ if Process.respond_to?(:warmup)
261
+ Process.warmup
262
+ else
263
+ force_move_to_oldgen
264
+ end
265
+ end
259
266
  end
260
267
  rescue StandardError, LoadError => e
261
268
  log_info("Proceeding with postload -- could not load #{path}: #{e} (#{e.class})\n #{e.backtrace.join("\n ")}", :upgrade)
@@ -307,7 +314,7 @@ module Einhorn
307
314
  end
308
315
 
309
316
  ARGV[0..-1] = cmd[idx + 1..-1]
310
- log_info("Set#{set_ps_name ? " $0 = #{$0.inspect}, " : nil} ARGV = #{ARGV.inspect}")
317
+ log_info("Set#{" $0 = #{$0.inspect}, " if set_ps_name} ARGV = #{ARGV.inspect}")
311
318
  end
312
319
 
313
320
  def self.set_master_ps_name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: einhorn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  - Mike Perham
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-10 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -67,19 +67,33 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1'
69
69
  - !ruby/object:Gem::Dependency
70
- name: fiddle
70
+ name: logger
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '1.1'
75
+ version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: readline
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: '1.1'
96
+ version: '0'
83
97
  description: Einhorn makes it easy to run multiple instances of an application server,
84
98
  all listening on the same port. You can also seamlessly restart your workers without
85
99
  dropping any requests. Einhorn requires minimal application-level support, making
@@ -143,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
157
  - !ruby/object:Gem::Version
144
158
  version: '0'
145
159
  requirements: []
146
- rubygems_version: 3.6.2
160
+ rubygems_version: 4.0.6
147
161
  specification_version: 4
148
162
  summary: 'Einhorn: the language-independent shared socket manager'
149
163
  test_files: []