redis 3.3.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ab43fd7b8221a41ea88facf6051b6c7b94e87bf
4
- data.tar.gz: 333fb1bbd2de6cd74db7cfd40542c979d92a6fbd
3
+ metadata.gz: 4744291b8bc26230044fc12c456951a60c5802c7
4
+ data.tar.gz: 6eabe9bb60b74aa2408007a72f9a44e831b71a5e
5
5
  SHA512:
6
- metadata.gz: 3f734315d527b2b92eeb1a6bff2089b583a06784f01fa411f68d4ad23cf9bdb5ae753d6da69a570014ac5d207cc765eb70107f8781c9e432457a7f81ef48fb98
7
- data.tar.gz: 686e1a0b28c573d7342335a52fc14d5636f2e1e32e8dba0adab663283e9d6fcc6acfd5d8b100b365ee54905a77a7c3a555c3c87917ef3a77b2689c8ff5afe927
6
+ metadata.gz: 7fb460a3595ed430dbf4dab6f516dcbef029cf1c72350e4e50b7e425e8d94b8d47760d33f58db21bad95852ec97fa7fdba55cfb0858292c221c947516a291f97
7
+ data.tar.gz: 7cdf461c39d5eede9b295bf987391cd70461cd5adcee945ae243d509f67457ea14aa0ad08ca47efdab8bb8ca315d6bdff94460d6cecc6b981f459081cd93dfbd
@@ -21,9 +21,12 @@ env:
21
21
  - VERBOSE=true
22
22
  - TIMEOUT=1
23
23
  matrix:
24
- - conn=ruby REDIS_BRANCH=2.8
25
- - conn=hiredis REDIS_BRANCH=2.8
26
- - conn=synchrony REDIS_BRANCH=2.8
24
+ - conn=ruby REDIS_BRANCH=3.0
25
+ - conn=ruby REDIS_BRANCH=3.2
26
+ - conn=hiredis REDIS_BRANCH=3.0
27
+ - conn=hiredis REDIS_BRANCH=3.2
28
+ - conn=synchrony REDIS_BRANCH=3.0
29
+ - conn=synchrony REDIS_BRANCH=3.2
27
30
  - conn=ruby REDIS_BRANCH=unstable
28
31
 
29
32
  branches:
@@ -35,27 +38,48 @@ matrix:
35
38
  # hiredis
36
39
  - rvm: jruby-18mode
37
40
  gemfile: .travis/Gemfile
38
- env: conn=hiredis REDIS_BRANCH=2.8
41
+ env: conn=hiredis REDIS_BRANCH=3.0
42
+ - rvm: jruby-18mode
43
+ gemfile: .travis/Gemfile
44
+ env: conn=hiredis REDIS_BRANCH=3.2
45
+ - rvm: jruby-19mode
46
+ gemfile: .travis/Gemfile
47
+ env: conn=hiredis REDIS_BRANCH=3.0
39
48
  - rvm: jruby-19mode
40
49
  gemfile: .travis/Gemfile
41
- env: conn=hiredis REDIS_BRANCH=2.8
50
+ env: conn=hiredis REDIS_BRANCH=3.2
42
51
  - rvm: jruby-9.0.5.0
43
52
  gemfile: .travis/Gemfile
44
- env: conn=hiredis REDIS_BRANCH=2.8
53
+ env: conn=hiredis REDIS_BRANCH=3.0
54
+ - rvm: jruby-9.0.5.0
55
+ gemfile: .travis/Gemfile
56
+ env: conn=hiredis REDIS_BRANCH=3.2
45
57
 
46
58
  # synchrony
47
59
  - rvm: 1.8.7
48
60
  gemfile: .travis/Gemfile
49
- env: conn=synchrony REDIS_BRANCH=2.8
61
+ env: conn=synchrony REDIS_BRANCH=3.0
62
+ - rvm: 1.8.7
63
+ gemfile: .travis/Gemfile
64
+ env: conn=synchrony REDIS_BRANCH=3.2
65
+ - rvm: jruby-18mode
66
+ gemfile: .travis/Gemfile
67
+ env: conn=synchrony REDIS_BRANCH=3.0
50
68
  - rvm: jruby-18mode
51
69
  gemfile: .travis/Gemfile
52
- env: conn=synchrony REDIS_BRANCH=2.8
70
+ env: conn=synchrony REDIS_BRANCH=3.2
53
71
  - rvm: jruby-19mode
54
72
  gemfile: .travis/Gemfile
55
- env: conn=synchrony REDIS_BRANCH=2.8
73
+ env: conn=synchrony REDIS_BRANCH=3.0
74
+ - rvm: jruby-19mode
75
+ gemfile: .travis/Gemfile
76
+ env: conn=synchrony REDIS_BRANCH=3.2
77
+ - rvm: jruby-9.0.5.0
78
+ gemfile: .travis/Gemfile
79
+ env: conn=synchrony REDIS_BRANCH=3.0
56
80
  - rvm: jruby-9.0.5.0
57
81
  gemfile: .travis/Gemfile
58
- env: conn=synchrony REDIS_BRANCH=2.8
82
+ env: conn=synchrony REDIS_BRANCH=3.2
59
83
  allow_failures:
60
84
  - rvm: rbx-2
61
85
 
@@ -12,6 +12,11 @@
12
12
  security updates in June of 2013; continuing to support it would prevent
13
13
  the use of newer features of Ruby.
14
14
 
15
+ # 3.3.1
16
+
17
+ * Remove usage of Timeout::timeout, refactor into using low level non-blocking writes.
18
+ This fixes a memory leak due to Timeout creating threads on each invocation.
19
+
15
20
  # 3.3.0
16
21
 
17
22
  * Added support for SSL/TLS. Redis doesn't support SSL natively, so you still
@@ -10,6 +10,16 @@ rescue LoadError
10
10
  # Not all systems have OpenSSL support
11
11
  end
12
12
 
13
+ if RUBY_VERSION < "1.9.3"
14
+ class String
15
+ # Ruby 1.8.7 does not have byteslice, but it handles encodings differently anyway.
16
+ # We can simply slice the string, which is a byte array there.
17
+ def byteslice(*args)
18
+ slice(*args)
19
+ end
20
+ end
21
+ end
22
+
13
23
  class Redis
14
24
  module Connection
15
25
  module SocketMixin
@@ -80,9 +90,34 @@ class Redis
80
90
  raise Errno::ECONNRESET
81
91
  end
82
92
 
83
- # UNIXSocket and TCPSocket don't support write timeouts
84
- def write(*args)
85
- Timeout.timeout(@write_timeout, TimeoutError) { super }
93
+ def _write_to_socket(data)
94
+ begin
95
+ write_nonblock(data)
96
+
97
+ rescue *NBIO_EXCEPTIONS
98
+ if IO.select(nil, [self], nil, @write_timeout)
99
+ retry
100
+ else
101
+ raise Redis::TimeoutError
102
+ end
103
+ end
104
+
105
+ rescue EOFError
106
+ raise Errno::ECONNRESET
107
+ end
108
+
109
+ def write(data)
110
+ return super(data) unless @write_timeout
111
+
112
+ length = data.bytesize
113
+ total_count = 0
114
+ loop do
115
+ count = _write_to_socket(data)
116
+
117
+ total_count += count
118
+ return total_count if total_count >= length
119
+ data = data.byteslice(count..-1)
120
+ end
86
121
  end
87
122
  end
88
123
 
@@ -1,3 +1,3 @@
1
1
  class Redis
2
- VERSION = "3.3.0"
2
+ VERSION = "3.3.1"
3
3
  end
@@ -5,6 +5,7 @@ require File.expand_path("helper", File.dirname(__FILE__))
5
5
  class TestInternals < Test::Unit::TestCase
6
6
 
7
7
  include Helper::Client
8
+ include Helper::Skipable
8
9
 
9
10
  def test_logger
10
11
  r.ping
@@ -160,6 +161,25 @@ class TestInternals < Test::Unit::TestCase
160
161
  assert (Time.now - start_time) <= opts[:timeout]
161
162
  end
162
163
 
164
+ driver(:ruby) do
165
+ def test_write_timeout
166
+ return skip("Relies on buffer sizes, might be unreliable")
167
+
168
+ server = TCPServer.new("127.0.0.1", 0)
169
+ port = server.addr[1]
170
+
171
+ # Hacky, but we need the buffer size
172
+ val = TCPSocket.new("127.0.0.1", port).getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF).unpack("i")[0]
173
+
174
+ assert_raise(Redis::TimeoutError) do
175
+ Timeout.timeout(1) do
176
+ redis = Redis.new(:port => port, :timeout => 5, :write_timeout => 0.1)
177
+ redis.set("foo", "1" * val*2)
178
+ end
179
+ end
180
+ end
181
+ end
182
+
163
183
  def close_on_ping(seq, options = {})
164
184
  $request = 0
165
185
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.expand_path("helper", File.dirname(__FILE__))
4
4
 
5
- class SentinalCommandsTest < Test::Unit::TestCase
5
+ class SentinelCommandsTest < Test::Unit::TestCase
6
6
 
7
7
  include Helper::Client
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.expand_path("helper", File.dirname(__FILE__))
4
4
 
5
- class SentinalTest < Test::Unit::TestCase
5
+ class SentinelTest < Test::Unit::TestCase
6
6
 
7
7
  include Helper::Client
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Zygmuntowicz
@@ -16,20 +16,20 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2016-04-18 00:00:00.000000000 Z
19
+ date: 2016-07-18 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rake
23
23
  requirement: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - <
25
+ - - "<"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 11.0.0
28
28
  type: :development
29
29
  prerelease: false
30
30
  version_requirements: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - <
32
+ - - "<"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 11.0.0
35
35
  - !ruby/object:Gem::Dependency
@@ -56,10 +56,10 @@ executables: []
56
56
  extensions: []
57
57
  extra_rdoc_files: []
58
58
  files:
59
- - .gitignore
60
- - .travis.yml
61
- - .travis/Gemfile
62
- - .yardopts
59
+ - ".gitignore"
60
+ - ".travis.yml"
61
+ - ".travis/Gemfile"
62
+ - ".yardopts"
63
63
  - CHANGELOG.md
64
64
  - Gemfile
65
65
  - LICENSE
@@ -184,17 +184,17 @@ require_paths:
184
184
  - lib
185
185
  required_ruby_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
- - - '>='
187
+ - - ">="
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - '>='
192
+ - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
196
  rubyforge_project:
197
- rubygems_version: 2.4.6
197
+ rubygems_version: 2.5.1
198
198
  signing_key:
199
199
  specification_version: 4
200
200
  summary: A Ruby client library for Redis