sidekiq 6.1.2 → 6.1.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sidekiq might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a80310735fb458e7332a5ecc86072248e0777e1951f77f14965c06313c5b2f8
4
- data.tar.gz: bfd09dc57c4506ca9c4d74dd9a38e88ef18700aafaf92814d662c6df4e4b2e5b
3
+ metadata.gz: eafcca9d632a83e39c7e69e47d104493f32b07974d58724347181ea1d9c47511
4
+ data.tar.gz: '08b987ddd7686f813f29a24d9d9027093f97307e7a22e24c355ed8b3d4c49362'
5
5
  SHA512:
6
- metadata.gz: c0e416fe575874c2051e88c64a6cbb30ad2ba4929ca33487ca1323b1963101d3d08ed43b8edbe874bccfa677521b0745baf589b451c7c56ff41b7bc70ee4f88d
7
- data.tar.gz: 4d1cd6d03768f9844bd8edd9bdb545a743084322f4edc01682e04b0990b0fb6aa3f1c6ad4f9a87c1b810a07e03b08eae0405ad2291b42d58eebb257bed7a60f4
6
+ metadata.gz: 615b18ce20c57301cb4117e6fbeab847b6ba41377ed1ba22d98e32e2df579f1cef1138b0c2757a51a988b0ecef83e47992754fbdb5b96a6f6d653a294755e36c
7
+ data.tar.gz: c3f3a44a85fc7a1c9405f59bba34842892c8a23e49a3ebac8dce5ba35b48738a9c5ba71635b671d2c6b9b711e5692d780a71ebf4a0b3c66ba8ac95c8ab9f319b
@@ -14,7 +14,7 @@ versions of Ruby and Rails and adds support for RTL languages in the Web UI.
14
14
  integrated as Sidekiq middleware; the logging/retry logic had to be pulled out
15
15
  too. Sidekiq 4.2 had a hack to make it work but this redesign provides
16
16
  a cleaner integration. [#3235]
17
- * The Delayed Extensions `delay`, `delay_in` and `delay_until` APIs are
17
+ * The Delayed Extensions `delay`, `delay_for` and `delay_until` APIs are
18
18
  no longer available by default. The extensions allow you to marshal
19
19
  job arguments as YAML, leading to cases where job payloads could be many
20
20
  100s of KB or larger if not careful, leading to Redis networking
data/Changes.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
4
4
 
5
+ 6.1.3
6
+ ---------
7
+
8
+ - Warn if Redis is configured to evict data under memory pressure [#4752]
9
+ - Add process RSS on the Busy page [#4717]
10
+
5
11
  6.1.2
6
12
  ---------
7
13
 
@@ -150,7 +156,7 @@ assert_equal 1, Sidekiq::Extensions::DelayedMailer.jobs_for(FooMailer).size
150
156
 
151
157
  This release has major breaking changes. Read and test carefully in production.
152
158
 
153
- - With Rails 6.0.1+, ActiveJobs can now use `sidekiq_options` directly to configure Sidekiq
159
+ - With Rails 6.0.2+, ActiveJobs can now use `sidekiq_options` directly to configure Sidekiq
154
160
  features/internals like the retry subsystem. [#4213, pirj]
155
161
  ```ruby
156
162
  class MyJob < ActiveJob::Base
@@ -4,6 +4,34 @@
4
4
 
5
5
  Please see [sidekiq.org](https://sidekiq.org) for more details and how to buy.
6
6
 
7
+ 2.2.1
8
+ -------------
9
+
10
+ - Support configurable timezones for periodic jobs [#4749]
11
+ - Handle edge case leading to negative expiry in uniqueness [#4763]
12
+
13
+ 2.2.0
14
+ -------------
15
+
16
+ - Add new **leaky bucket** rate limiter [#4414]
17
+ This allows clients to burst up to X calls before throttling
18
+ back to X calls per Y seconds. To limit the user to 60 calls
19
+ per minute:
20
+ ```ruby
21
+ leaker = Sidekiq::Limiter.leaky("shopify", 60, :minute)
22
+ leaker.within_limit do
23
+ ...
24
+ end
25
+ ```
26
+ See the Rate Limiting wiki page for more detail.
27
+ - Rate limiters may now customize their reschedule count [#4725]
28
+ To disable rate limit reschedules, use `reschedule: 0`.
29
+ ```ruby
30
+ Sidekiq::Limiter.concurrent("somename", 5, reschedule: 0)
31
+ ```
32
+ - Allow filtering by name in the Rate Limiter UI [#4695]
33
+ - Add IT locale
34
+
7
35
  2.1.2
8
36
  -------------
9
37
 
@@ -91,12 +91,12 @@ GEM
91
91
  mimemagic (0.3.5)
92
92
  mini_mime (1.0.2)
93
93
  mini_portile2 (2.4.0)
94
- minitest (5.14.1)
94
+ minitest (5.14.3)
95
95
  nio4r (2.5.2)
96
96
  nokogiri (1.10.10)
97
97
  mini_portile2 (~> 2.4.0)
98
- parallel (1.19.2)
99
- parser (2.7.1.4)
98
+ parallel (1.20.1)
99
+ parser (2.7.2.0)
100
100
  ast (~> 2.4.1)
101
101
  rack (2.2.3)
102
102
  rack-test (1.1.0)
@@ -129,29 +129,30 @@ GEM
129
129
  thor (>= 0.20.3, < 2.0)
130
130
  rainbow (3.0.0)
131
131
  rake (13.0.1)
132
- redis (4.2.1)
133
- redis-namespace (1.8.0)
132
+ redis (4.2.5)
133
+ redis-namespace (1.6.0)
134
134
  redis (>= 3.0.4)
135
- regexp_parser (1.7.1)
135
+ regexp_parser (2.0.0)
136
136
  rexml (3.2.4)
137
- rubocop (0.89.1)
137
+ rubocop (1.4.2)
138
138
  parallel (~> 1.10)
139
- parser (>= 2.7.1.1)
139
+ parser (>= 2.7.1.5)
140
140
  rainbow (>= 2.2.2, < 4.0)
141
- regexp_parser (>= 1.7)
141
+ regexp_parser (>= 1.8)
142
142
  rexml
143
- rubocop-ast (>= 0.3.0, < 1.0)
143
+ rubocop-ast (>= 1.1.1)
144
144
  ruby-progressbar (~> 1.7)
145
145
  unicode-display_width (>= 1.4.0, < 2.0)
146
- rubocop-ast (0.3.0)
147
- parser (>= 2.7.1.4)
148
- rubocop-performance (1.7.1)
149
- rubocop (>= 0.82.0)
146
+ rubocop-ast (1.3.0)
147
+ parser (>= 2.7.1.5)
148
+ rubocop-performance (1.9.1)
149
+ rubocop (>= 0.90.0, < 2.0)
150
+ rubocop-ast (>= 0.4.0)
150
151
  ruby-progressbar (1.10.1)
151
152
  simplecov (0.19.0)
152
153
  docile (~> 1.1)
153
154
  simplecov-html (~> 0.11)
154
- simplecov-html (0.12.2)
155
+ simplecov-html (0.12.3)
155
156
  sprockets (4.0.2)
156
157
  concurrent-ruby (~> 1.0)
157
158
  rack (> 1, < 3)
@@ -160,9 +161,9 @@ GEM
160
161
  activesupport (>= 4.0)
161
162
  sprockets (>= 3.0.0)
162
163
  sqlite3 (1.4.2)
163
- standard (0.5.2)
164
- rubocop (~> 0.89.1)
165
- rubocop-performance (~> 1.7.1)
164
+ standard (0.10.2)
165
+ rubocop (= 1.4.2)
166
+ rubocop-performance (= 1.9.1)
166
167
  thor (1.0.1)
167
168
  thread_safe (0.3.6)
168
169
  toxiproxy (1.0.3)
@@ -4,6 +4,14 @@
4
4
 
5
5
  Please see [sidekiq.org](https://sidekiq.org/) for more details and how to buy.
6
6
 
7
+ 5.2.1
8
+ ---------
9
+
10
+ - Propagate death callbacks to parent batches [#4774]
11
+ - Allow customization of Batch linger to quickly reclaim memory in Redis [#4772]
12
+ - Fix disappearing processes in Busy due to super_fetch initialization when used in
13
+ tandem with `SIDEKIQ_PRELOAD_APP=1` in `sidekiqswarm`. [#4733]
14
+
7
15
  5.2.0
8
16
  ---------
9
17
 
@@ -85,10 +85,10 @@ module Sidekiq
85
85
 
86
86
  default_queue_latency = if (entry = pipe1_res[6].first)
87
87
  job = begin
88
- Sidekiq.load_json(entry)
89
- rescue
90
- {}
91
- end
88
+ Sidekiq.load_json(entry)
89
+ rescue
90
+ {}
91
+ end
92
92
  now = Time.now.to_f
93
93
  thence = job["enqueued_at"] || now
94
94
  now - thence
@@ -791,19 +791,22 @@ module Sidekiq
791
791
  # you'll be happier this way
792
792
  conn.pipelined do
793
793
  procs.each do |key|
794
- conn.hmget(key, "info", "busy", "beat", "quiet")
794
+ conn.hmget(key, "info", "busy", "beat", "quiet", "rss")
795
795
  end
796
796
  end
797
797
  }
798
798
 
799
- result.each do |info, busy, at_s, quiet|
799
+ result.each do |info, busy, at_s, quiet, rss|
800
800
  # If a process is stopped between when we query Redis for `procs` and
801
801
  # when we query for `result`, we will have an item in `result` that is
802
802
  # composed of `nil` values.
803
803
  next if info.nil?
804
804
 
805
805
  hash = Sidekiq.load_json(info)
806
- yield Process.new(hash.merge("busy" => busy.to_i, "beat" => at_s.to_f, "quiet" => quiet))
806
+ yield Process.new(hash.merge("busy" => busy.to_i,
807
+ "beat" => at_s.to_f,
808
+ "quiet" => quiet,
809
+ "rss" => rss))
807
810
  end
808
811
  end
809
812
 
@@ -59,9 +59,22 @@ module Sidekiq
59
59
 
60
60
  # touch the connection pool so it is created before we
61
61
  # fire startup and start multithreading.
62
- ver = Sidekiq.redis_info["redis_version"]
62
+ info = Sidekiq.redis_info
63
+ ver = info["redis_version"]
63
64
  raise "You are connecting to Redis v#{ver}, Sidekiq requires Redis v4.0.0 or greater" if ver < "4"
64
65
 
66
+ maxmemory_policy = info["maxmemory_policy"]
67
+ if maxmemory_policy != "noeviction"
68
+ logger.warn <<~EOM
69
+
70
+
71
+ WARNING: Your Redis instance will evict Sidekiq data under heavy load.
72
+ The 'noeviction' maxmemory policy is recommended (current policy: '#{maxmemory_policy}').
73
+ See: https://github.com/mperham/sidekiq/wiki/Using-Redis#memory
74
+
75
+ EOM
76
+ end
77
+
65
78
  # Since the user can pass us a connection pool explicitly in the initializer, we
66
79
  # need to verify the size is large enough or else Sidekiq's performance is dramatically slowed.
67
80
  cursize = Sidekiq.redis_pool.size
@@ -19,7 +19,7 @@ module Sidekiq
19
19
  #
20
20
  def middleware(&block)
21
21
  @chain ||= Sidekiq.client_middleware
22
- if block_given?
22
+ if block
23
23
  @chain = @chain.dup
24
24
  yield @chain
25
25
  end
@@ -61,6 +61,7 @@ module Sidekiq
61
61
  #
62
62
  class JobRetry
63
63
  class Handled < ::RuntimeError; end
64
+
64
65
  class Skip < Handled; end
65
66
 
66
67
  include Sidekiq::Util
@@ -154,12 +154,17 @@ module Sidekiq
154
154
  end
155
155
 
156
156
  fails = procd = 0
157
+ kb = memory_usage(::Process.pid)
157
158
 
158
159
  _, exists, _, _, msg = Sidekiq.redis { |conn|
159
160
  conn.multi {
160
161
  conn.sadd("processes", key)
161
162
  conn.exists?(key)
162
- conn.hmset(key, "info", to_json, "busy", curstate.size, "beat", Time.now.to_f, "quiet", @done)
163
+ conn.hmset(key, "info", to_json,
164
+ "busy", curstate.size,
165
+ "beat", Time.now.to_f,
166
+ "quiet", @done,
167
+ "rss", kb)
163
168
  conn.expire(key, 60)
164
169
  conn.rpop("#{key}-signals")
165
170
  }
@@ -180,6 +185,26 @@ module Sidekiq
180
185
  end
181
186
  end
182
187
 
188
+ MEMORY_GRABBER = case RUBY_PLATFORM
189
+ when /linux/
190
+ ->(pid) {
191
+ IO.readlines("/proc/#{$$}/status").each do |line|
192
+ next unless line.start_with?("VmRSS:")
193
+ break line.split[1].to_i
194
+ end
195
+ }
196
+ when /darwin|bsd/
197
+ ->(pid) {
198
+ `ps -o pid,rss -p #{pid}`.lines.last.split.last.to_i
199
+ }
200
+ else
201
+ ->(pid) { 0 }
202
+ end
203
+
204
+ def memory_usage(pid)
205
+ MEMORY_GRABBER.call(pid)
206
+ end
207
+
183
208
  def to_data
184
209
  @data ||= begin
185
210
  {
@@ -6,10 +6,11 @@ require "time"
6
6
  module Sidekiq
7
7
  module Context
8
8
  def self.with(hash)
9
+ orig_context = current.dup
9
10
  current.merge!(hash)
10
11
  yield
11
12
  ensure
12
- hash.each_key { |key| current.delete(key) }
13
+ Thread.current[:sidekiq_context] = orig_context
13
14
  end
14
15
 
15
16
  def self.current
@@ -89,7 +90,7 @@ module Sidekiq
89
90
  return true if @logdev.nil? || severity < level
90
91
 
91
92
  if message.nil?
92
- if block_given?
93
+ if block
93
94
  message = yield
94
95
  else
95
96
  message = progname
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sidekiq
4
- VERSION = "6.1.2"
4
+ VERSION = "6.1.3"
5
5
  end
@@ -316,7 +316,7 @@ module Sidekiq
316
316
  end
317
317
 
318
318
  def self.helpers(mod = nil, &block)
319
- if block_given?
319
+ if block
320
320
  WebAction.class_eval(&block)
321
321
  else
322
322
  WebAction.send(:include, mod)
@@ -90,13 +90,11 @@ module Sidekiq
90
90
  end
91
91
 
92
92
  sess = session(env)
93
-
94
- # Checks that Rack::Session::Cookie did not return empty session
95
- # object in case the digest verification failed
96
- return false if sess.empty?
97
-
98
93
  localtoken = sess[:csrf]
99
94
 
95
+ # Checks that Rack::Session::Cookie actualy contains the csrf toekn
96
+ return false if localtoken.nil?
97
+
100
98
  # Rotate the session token after every use
101
99
  sess[:csrf] = SecureRandom.base64(TOKEN_LENGTH)
102
100
 
@@ -258,7 +258,19 @@ module Sidekiq
258
258
  end
259
259
  end
260
260
 
261
+ def format_memory(rss_kb)
262
+ return "" if rss_kb.nil? || rss_kb == 0
263
+
264
+ if rss_kb < 100_000
265
+ "#{number_with_delimiter(rss_kb)} KB"
266
+ else
267
+ "#{number_with_delimiter((rss_kb / 1024.0).to_i)} MB"
268
+ end
269
+ end
270
+
261
271
  def number_with_delimiter(number)
272
+ return "" if number.nil?
273
+
262
274
  begin
263
275
  Float(number)
264
276
  rescue ArgumentError, TypeError
@@ -5,7 +5,7 @@ Gem::Specification.new do |gem|
5
5
  gem.email = ["mperham@gmail.com"]
6
6
  gem.summary = "Simple, efficient background processing for Ruby"
7
7
  gem.description = "Simple, efficient background processing for Ruby."
8
- gem.homepage = "http://sidekiq.org"
8
+ gem.homepage = "https://sidekiq.org"
9
9
  gem.license = "LGPL-3.0"
10
10
 
11
11
  gem.executables = ["sidekiq", "sidekiqmon"]
@@ -75,6 +75,12 @@ a.btn {
75
75
  color: #000;
76
76
  }
77
77
 
78
+ input {
79
+ background-color: #444;
80
+ color: #ccc;
81
+ padding: 3px;
82
+ }
83
+
78
84
  .summary_bar .summary {
79
85
  background-color: #222;
80
86
  border: 1px solid #555;
@@ -1152,3 +1152,15 @@ div.interval-slider input {
1152
1152
  .delete-confirm {
1153
1153
  width: 20%;
1154
1154
  }
1155
+
1156
+ .circled {
1157
+ border-color: #333;
1158
+ color: #eee;
1159
+ background-color: #b1003e;
1160
+ border-radius: 50%;
1161
+ text-align: center;
1162
+ vertical-align: middle;
1163
+ padding: 3px 7px;
1164
+ font-size: 0.7em;
1165
+ margin-left: 5px;
1166
+ }
@@ -72,7 +72,7 @@ fr:
72
72
  Quiet: Clore
73
73
  StopAll: Tout arrêter
74
74
  QuietAll: Tout clore
75
- PollingInterval: Interval de rafraîchissement
75
+ PollingInterval: Intervalle de rafraîchissement
76
76
  Plugins: Plugins
77
77
  NotYetEnqueued: Pas encore en file d'attente
78
78
  CreatedAt: Créée le
@@ -18,6 +18,7 @@
18
18
  <thead>
19
19
  <th><%= t('Name') %></th>
20
20
  <th><%= t('Started') %></th>
21
+ <th><%= t('RSS') %><a href="https://github.com/mperham/sidekiq/wiki/Memory#rss"><span class="circled" title="Click to learn more about RSS">?</span></a></th>
21
22
  <th><%= t('Threads') %></th>
22
23
  <th><%= t('Busy') %></th>
23
24
  <th>&nbsp;</th>
@@ -42,6 +43,7 @@
42
43
  <%= process['queues'] * ", " %>
43
44
  </td>
44
45
  <td><%= relative_time(Time.at(process['started_at'])) %></td>
46
+ <td><%= format_memory(process['rss'].to_i) %></td>
45
47
  <td><%= process['concurrency'] %></td>
46
48
  <td><%= process['busy'] %></td>
47
49
  <td>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.2
4
+ version: 6.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-07 00:00:00.000000000 Z
11
+ date: 2021-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -186,7 +186,7 @@ files:
186
186
  - web/views/retry.erb
187
187
  - web/views/scheduled.erb
188
188
  - web/views/scheduled_job_info.erb
189
- homepage: http://sidekiq.org
189
+ homepage: https://sidekiq.org
190
190
  licenses:
191
191
  - LGPL-3.0
192
192
  metadata: {}
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
207
  requirements: []
208
- rubygems_version: 3.1.2
208
+ rubygems_version: 3.1.4
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Simple, efficient background processing for Ruby