serverengine 2.2.3 → 2.2.4

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
  SHA256:
3
- metadata.gz: c37776b7f6420e895262df160ce7156bf00b6c3adaccd8af016e2d35c2d49f28
4
- data.tar.gz: 7109cb65899f1afd047c3a6ddce8dee6b51dcbf69d1c7bc0ef80937214a90850
3
+ metadata.gz: f04e7c4dc99fb0496568579a6516ac6df8bdae3d5c8927aa9586ff3fa530876d
4
+ data.tar.gz: fcdc7828debe292af0950c9f3d3c8947c05733d3e338449667fe4b057e425c5b
5
5
  SHA512:
6
- metadata.gz: f92e476daba00bad71a9de2bb924187926bcc071266b510cba15741f584a3d14333d28533c9530d48f8b9820bd1fb9522bd1bfa5f3c1c858f238f44042a803cd
7
- data.tar.gz: 0bd8378d0840b3ca89bae30999317925f9e3155d9c37fb3a9d5482c95f1be0350fa60b82c8d0706d5cdea40573f5bdf2801d4717f55b22da32469177895c15b5
6
+ metadata.gz: 1dc366572a0df514840c8e5f74bacf1d801f86f402de15c125006d332e256be1239e91991ce02aaad82be9b0ec45eb0305c7792e39b1d666edb674671c533761
7
+ data.tar.gz: c45dd0d66fe2c55e9cb71bdf930db49f33abcd08d14071aa5bb130d0119e1828691c2d6aab9372538c24b3d784dee767c625f7b2348cd03b525b1338970a32c3
@@ -0,0 +1,26 @@
1
+ name: Testing on Ubuntu
2
+ on:
3
+ - push
4
+ - pull_request
5
+ jobs:
6
+ build:
7
+ runs-on: ${{ matrix.os }}
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby: [ '3.0', '2.7', '2.6', '2.5' ]
12
+ os:
13
+ - ubuntu-latest
14
+ name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - name: unit testing
21
+ env:
22
+ CI: true
23
+ run: |
24
+ gem install bundler rake
25
+ bundle install --jobs 4 --retry 3
26
+ bundle exec rake spec
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ 2021-05-24 version 2.2.4:
2
+
3
+ * Ensure to get correct Win32 socket error on Ruby 3.0
4
+
1
5
  2021-02-17 version 2.2.3:
2
6
 
3
7
  * Change SocketManager's port assignment strategy on Windows
data/NOTICE CHANGED
@@ -1,3 +1,3 @@
1
1
  ServerEngine
2
- https://github.com/frsyuki/serverengine
2
+ https://github.com/treasure-data/serverengine
3
3
  Copyright (C) 2012-2013 Sadayuki Furuhashi
data/appveyor.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  ---
2
+ image: Visual Studio 2019
3
+
2
4
  install:
3
5
  - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
4
6
  - ruby --version
@@ -6,19 +8,28 @@ install:
6
8
  - bundle install
7
9
  build: off
8
10
  test_script:
9
- - bundle exec rake -rdevkit
11
+ - bundle exec rake spec
10
12
 
11
13
  environment:
12
14
  matrix:
13
- - ruby_version: "23-x64"
14
- devkit: C:\Ruby23-x64\DevKit
15
- - ruby_version: "23"
16
- devkit: C:\Ruby23\DevKit
17
- - ruby_version: "22-x64"
18
- devkit: C:\Ruby23-x64\DevKit
19
- - ruby_version: "22"
20
- devkit: C:\Ruby23\DevKit
21
- - ruby_version: "21-x64"
22
- devkit: C:\Ruby23-x64\DevKit
23
- - ruby_version: "21"
24
- devkit: C:\Ruby23\DevKit
15
+ - ruby_version: "30-x64"
16
+ - ruby_version: "27-x64"
17
+ - ruby_version: "26-x64"
18
+ - ruby_version: "25-x64"
19
+
20
+ # On Ruby 3.0, we need to use fiddle 1.0.8 or later to retrieve correct
21
+ # error code. In addition, we have to specify the path of fiddle by RUBYLIB
22
+ # because RubyInstaller loads Ruby's bundled fiddle before initializing gem.
23
+ # See also:
24
+ # * https://github.com/ruby/fiddle/issues/72
25
+ # * https://bugs.ruby-lang.org/issues/17813
26
+ # * https://github.com/oneclick/rubyinstaller2/blob/8225034c22152d8195bc0aabc42a956c79d6c712/lib/ruby_installer/build/dll_directory.rb
27
+ for:
28
+ -
29
+ matrix:
30
+ only:
31
+ - ruby_version: "30-x64"
32
+ test_script:
33
+ - gem install fiddle --version 1.0.8
34
+ - set RUBYLIB=C:/Ruby%ruby_version%/lib/ruby/gems/3.0.0/gems/fiddle-1.0.8/lib
35
+ - bundle exec rake spec
@@ -1,3 +1,3 @@
1
1
  module ServerEngine
2
- VERSION = "2.2.3"
2
+ VERSION = "2.2.4"
3
3
  end
@@ -78,6 +78,19 @@ module ServerEngine
78
78
  end
79
79
  end
80
80
 
81
+ def self.last_error
82
+ # On Ruby 3.0 calling WSAGetLastError here can't retrieve correct error
83
+ # code because Ruby's internal code resets it.
84
+ # See also:
85
+ # * https://github.com/ruby/fiddle/issues/72
86
+ # * https://bugs.ruby-lang.org/issues/17813
87
+ if Fiddle.respond_to?(:win32_last_socket_error)
88
+ Fiddle.win32_last_socket_error || 0
89
+ else
90
+ self.WSAGetLastError
91
+ end
92
+ end
93
+
81
94
  INVALID_SOCKET = -1
82
95
  end
83
96
 
@@ -99,7 +112,7 @@ module ServerEngine
99
112
  extern "int rb_w32_map_errno(int)"
100
113
 
101
114
  def self.raise_last_error(name)
102
- errno = rb_w32_map_errno(WinSock.WSAGetLastError)
115
+ errno = rb_w32_map_errno(WinSock.last_error)
103
116
  raise SystemCallError.new(name, errno)
104
117
  end
105
118
 
@@ -20,10 +20,16 @@ describe ServerEngine::BlockingFlag do
20
20
  it 'wait_for_set timeout' do
21
21
  start = Time.now
22
22
 
23
- subject.wait_for_set(0.01)
23
+ subject.wait_for_set(0.1)
24
24
  elapsed = Time.now - start
25
25
 
26
- elapsed.should >= 0.01
26
+ if ServerEngine.windows? && ENV['CI'] == 'True'
27
+ # timer seems low accuracy on Windows CI container, often a bit shorter
28
+ # than expected
29
+ elapsed.should >= 0.1 * 0.95
30
+ else
31
+ elapsed.should >= 0.1
32
+ end
27
33
  end
28
34
 
29
35
  it 'wait_for_reset timeout' do
@@ -31,10 +37,16 @@ describe ServerEngine::BlockingFlag do
31
37
 
32
38
  start = Time.now
33
39
 
34
- subject.wait_for_reset(0.01)
40
+ subject.wait_for_reset(0.1)
35
41
  elapsed = Time.now - start
36
42
 
37
- elapsed.should >= 0.01
43
+ if ServerEngine.windows? && ENV['CI'] == 'True'
44
+ # timer seems low accuracy on Windows CI container, often a bit shorter
45
+ # than expected
46
+ elapsed.should >= 0.1 * 0.95
47
+ else
48
+ elapsed.should >= 0.1
49
+ end
38
50
  end
39
51
 
40
52
  it 'wait' do
@@ -254,7 +254,7 @@ shared_context 'test server and worker' do
254
254
  before { reset_test_state }
255
255
 
256
256
  def wait_for_fork
257
- sleep 0.8
257
+ sleep 1.5
258
258
  end
259
259
 
260
260
  def wait_for_stop
@@ -191,7 +191,7 @@ describe ServerEngine::Supervisor do
191
191
  sv, t = start_supervisor(RunErrorWorker, server_restart_wait: 1, command_sender: sender)
192
192
 
193
193
  begin
194
- sleep 2.2
194
+ sleep 2.5
195
195
  ensure
196
196
  sv.stop(true)
197
197
  t.join
@@ -0,0 +1,18 @@
1
+ require 'windows/error' if ServerEngine.windows?
2
+
3
+ describe ServerEngine::WinSock do
4
+ # On Ruby 3.0, you need to use fiddle 1.0.8 or later to retrieve a correct
5
+ # error code. In addition, you need to specify the path of fiddle by RUBYLIB
6
+ # or `ruby -I` when you use RubyInstaller because it loads Ruby's bundled
7
+ # fiddle before initializing gem.
8
+ # See also:
9
+ # * https://github.com/ruby/fiddle/issues/72
10
+ # * https://bugs.ruby-lang.org/issues/17813
11
+ # * https://github.com/oneclick/rubyinstaller2/blob/8225034c22152d8195bc0aabc42a956c79d6c712/lib/ruby_installer/build/dll_directory.rb
12
+ context 'last_error' do
13
+ it 'bind error' do
14
+ expect(WinSock.bind(0, nil, 0)).to be -1
15
+ expect(WinSock.last_error).to be Windows::Error::WSAENOTSOCK
16
+ end
17
+ end
18
+ end if ServerEngine.windows?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverengine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-17 00:00:00.000000000 Z
11
+ date: 2021-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sigdump
@@ -87,9 +87,9 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".github/workflows/linux.yml"
90
91
  - ".gitignore"
91
92
  - ".rspec"
92
- - ".travis.yml"
93
93
  - Changelog
94
94
  - Gemfile
95
95
  - LICENSE
@@ -134,6 +134,7 @@ files:
134
134
  - spec/socket_manager_spec.rb
135
135
  - spec/spec_helper.rb
136
136
  - spec/supervisor_spec.rb
137
+ - spec/winsock_spec.rb
137
138
  homepage: https://github.com/fluent/serverengine
138
139
  licenses:
139
140
  - Apache 2.0
@@ -153,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  - !ruby/object:Gem::Version
154
155
  version: '0'
155
156
  requirements: []
156
- rubygems_version: 3.1.4
157
+ rubygems_version: 3.2.5
157
158
  signing_key:
158
159
  specification_version: 4
159
160
  summary: ServerEngine - multiprocess server framework
@@ -168,3 +169,4 @@ test_files:
168
169
  - spec/socket_manager_spec.rb
169
170
  - spec/spec_helper.rb
170
171
  - spec/supervisor_spec.rb
172
+ - spec/winsock_spec.rb
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.4.9
5
- - 2.5.7
6
- - 2.6.5
7
- - 2.7
8
- - ruby-head
9
-
10
- branches:
11
- only:
12
- - master
13
-
14
- script: bundle exec rake spec
15
-
16
- before_install:
17
- - gem update bundler
18
-
19
- matrix:
20
- allow_failures:
21
- - rvm: ruby-head